Ipopt Documentation  
IpNLPBoundsRemover.hpp
Go to the documentation of this file.
1// Copyright (C) 2008, 2010 International Business Machines and others.
2// All Rights Reserved.
3// This code is published under the Eclipse Public License.
4//
5// Authors: Andreas Waechter IBM 2008-08-25
6
7#ifndef __IPNLPBOUNDSREMOVER_HPP__
8#define __IPNLPBOUNDSREMOVER_HPP__
9
10#include "IpNLP.hpp"
11
12namespace Ipopt
13{
14
23class NLPBoundsRemover: public NLP
24{
25public:
28
32 NLP& nlp,
33 bool allow_twosided_inequalities = false
34 );
35
38 { }
40
43
46 virtual bool ProcessOptions(
47 const OptionsList& options,
48 const std::string& prefix
49 )
50 {
51 return nlp_->ProcessOptions(options, prefix);
52 }
53
58 virtual bool GetSpaces(
70 SmartPtr<const MatrixSpace>& Jac_c_space,
71 SmartPtr<const MatrixSpace>& Jac_d_space,
72 SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space
73 );
74
77 const Matrix& Px_L,
78 Vector& x_L,
79 const Matrix& Px_U,
80 Vector& x_U,
81 const Matrix& Pd_L,
82 Vector& d_L,
83 const Matrix& Pd_U,
84 Vector& d_U
85 );
86
88 // ToDo it might not make sense to ask for initial values for v_L and v_U?
89 virtual bool GetStartingPoint(
91 bool need_x,
93 bool need_y_c,
95 bool need_y_d,
97 bool need_z_L,
99 bool need_z_U
100 );
101
108 IteratesVector& warm_start_iterate
109 )
110 {
111 return nlp_->GetWarmStartIterate(warm_start_iterate);
112 }
114
117 virtual bool Eval_f(
118 const Vector& x,
119 Number& f
120 )
121 {
122 return nlp_->Eval_f(x, f);
123 }
124
125 virtual bool Eval_grad_f(
126 const Vector& x,
127 Vector& g_f
128 )
129 {
130 return nlp_->Eval_grad_f(x, g_f);
131 }
132
133 virtual bool Eval_c(
134 const Vector& x,
135 Vector& c
136 )
137 {
138 return nlp_->Eval_c(x, c);
139 }
140
141 virtual bool Eval_jac_c(
142 const Vector& x,
143 Matrix& jac_c
144 )
145 {
146 return nlp_->Eval_jac_c(x, jac_c);
147 }
148
149 virtual bool Eval_d(
150 const Vector& x,
151 Vector& d
152 );
153
154 virtual bool Eval_jac_d(
155 const Vector& x,
156 Matrix& jac_d
157 );
158
159 virtual bool Eval_h(
160 const Vector& x,
161 Number obj_factor,
162 const Vector& yc,
163 const Vector& yd,
164 SymMatrix& h
165 );
167
170 virtual void FinalizeSolution(
171 SolverReturn status,
172 const Vector& x,
173 const Vector& z_L,
174 const Vector& z_U,
175 const Vector& c,
176 const Vector& d,
177 const Vector& y_c,
178 const Vector& y_d,
179 Number obj_value,
180 const IpoptData* ip_data,
182 );
183
185 AlgorithmMode mode,
186 Index iter,
187 Number obj_value,
188 Number inf_pr,
189 Number inf_du,
190 Number mu,
191 Number d_norm,
192 Number regularization_size,
193 Number alpha_du,
194 Number alpha_pr,
195 Index ls_trials,
196 const IpoptData* ip_data,
198 )
199 {
200 return nlp_->IntermediateCallBack(mode, iter, obj_value, inf_pr, inf_du, mu, d_norm, regularization_size,
201 alpha_du, alpha_pr, ls_trials, ip_data, ip_cq);
202 }
204
208 const SmartPtr<const VectorSpace> x_space,
209 const SmartPtr<const VectorSpace> c_space,
210 const SmartPtr<const VectorSpace> d_space,
211 Number& obj_scaling,
212 SmartPtr<Vector>& x_scaling,
213 SmartPtr<Vector>& c_scaling,
214 SmartPtr<Vector>& d_scaling
215 ) const;
217
219 SmartPtr<VectorSpace>& approx_space,
220 SmartPtr<Matrix>& P_approx
221 )
222 {
223 nlp_->GetQuasiNewtonApproximationSpaces(approx_space, P_approx);
224 }
225
228 {
229 return nlp_;
230 }
231
232private:
243
247 const NLPBoundsRemover&
248 );
249
252 const NLPBoundsRemover&
253 );
255
258
261
264
267
270};
271
272} // namespace Ipopt
273
274#endif
AlgorithmMode
enum to indicate the mode in which the algorithm is
Class for all IPOPT specific calculated quantities.
Class to organize all the data required by the algorithm.
Definition: IpIpoptData.hpp:98
Specialized CompoundVector class specifically for the algorithm iterates.
Matrix Base Class.
Definition: IpMatrix.hpp:28
This is an adapter for an NLP that converts variable bound constraints to inequality constraints.
void operator=(const NLPBoundsRemover &)
Default Assignment Operator.
virtual void GetQuasiNewtonApproximationSpaces(SmartPtr< VectorSpace > &approx_space, SmartPtr< Matrix > &P_approx)
Method for obtaining the subspace in which the limited-memory Hessian approximation should be done.
virtual bool Eval_c(const Vector &x, Vector &c)
bool allow_twosided_inequalities_
Flag indicating whether twosided inequality constraints are allowed.
virtual void FinalizeSolution(SolverReturn status, const Vector &x, const Vector &z_L, const Vector &z_U, const Vector &c, const Vector &d, const Vector &y_c, const Vector &y_d, Number obj_value, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq)
This method is called at the very end of the optimization.
NLPBoundsRemover(NLP &nlp, bool allow_twosided_inequalities=false)
The constructor is given the NLP of which the bounds are to be replaced by inequality constraints.
virtual bool Eval_grad_f(const Vector &x, Vector &g_f)
virtual bool Eval_jac_c(const Vector &x, Matrix &jac_c)
virtual bool Eval_f(const Vector &x, Number &f)
SmartPtr< NLP > nlp()
Accessor method to the original NLP.
NLPBoundsRemover(const NLPBoundsRemover &)
Copy Constructor.
SmartPtr< const Matrix > Px_u_orig_
Pointer to the expansion matrix for the upper x bounds.
virtual bool ProcessOptions(const OptionsList &options, const std::string &prefix)
Overload if you want the chance to process options or parameters that may be specific to the NLP.
NLPBoundsRemover()
Default Constructor.
virtual bool Eval_d(const Vector &x, Vector &d)
virtual bool IntermediateCallBack(AlgorithmMode mode, Index iter, Number obj_value, Number inf_pr, Number inf_du, Number mu, Number d_norm, Number regularization_size, Number alpha_du, Number alpha_pr, Index ls_trials, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq)
This method is called once per iteration, after the iteration summary output has been printed.
virtual bool GetBoundsInformation(const Matrix &Px_L, Vector &x_L, const Matrix &Px_U, Vector &x_U, const Matrix &Pd_L, Vector &d_L, const Matrix &Pd_U, Vector &d_U)
Method for obtaining the bounds information.
virtual bool GetSpaces(SmartPtr< const VectorSpace > &x_space, SmartPtr< const VectorSpace > &c_space, SmartPtr< const VectorSpace > &d_space, SmartPtr< const VectorSpace > &x_l_space, SmartPtr< const MatrixSpace > &px_l_space, SmartPtr< const VectorSpace > &x_u_space, SmartPtr< const MatrixSpace > &px_u_space, SmartPtr< const VectorSpace > &d_l_space, SmartPtr< const MatrixSpace > &pd_l_space, SmartPtr< const VectorSpace > &d_u_space, SmartPtr< const MatrixSpace > &pd_u_space, SmartPtr< const MatrixSpace > &Jac_c_space, SmartPtr< const MatrixSpace > &Jac_d_space, SmartPtr< const SymMatrixSpace > &Hess_lagrangian_space)
Method for creating the derived vector / matrix types.
virtual bool Eval_jac_d(const Vector &x, Matrix &jac_d)
virtual bool Eval_h(const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd, SymMatrix &h)
SmartPtr< const Matrix > Px_l_orig_
Pointer to the expansion matrix for the lower x bounds.
SmartPtr< NLP > nlp_
Pointer to the original NLP.
virtual bool GetStartingPoint(SmartPtr< Vector > x, bool need_x, SmartPtr< Vector > y_c, bool need_y_c, SmartPtr< Vector > y_d, bool need_y_d, SmartPtr< Vector > z_L, bool need_z_L, SmartPtr< Vector > z_U, bool need_z_U)
Method for obtaining the starting point for all the iterates.
SmartPtr< const VectorSpace > d_space_orig_
Pointer to the original d space.
virtual void GetScalingParameters(const SmartPtr< const VectorSpace > x_space, const SmartPtr< const VectorSpace > c_space, const SmartPtr< const VectorSpace > d_space, Number &obj_scaling, SmartPtr< Vector > &x_scaling, SmartPtr< Vector > &c_scaling, SmartPtr< Vector > &d_scaling) const
Routines to get the scaling parameters.
virtual bool GetWarmStartIterate(IteratesVector &warm_start_iterate)
Method for obtaining an entire iterate as a warmstart point.
virtual ~NLPBoundsRemover()
Destructor.
Traditional NLP.
Definition: IpNLP.hpp:42
This class stores a list of user set options.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:165
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:21
Vector Base Class.
Definition: IpVector.hpp:48
This file contains a base class for all exceptions and a set of macros to help with exceptions.
SolverReturn
enum for the return from the optimize algorithm
Definition: IpAlgTypes.hpp:20
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17