Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpIpoptNLP.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2006 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpIpoptNLP.hpp 2594 2015-08-09 14:31:05Z stefan $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8
9 #ifndef __IPIPOPTNLP_HPP__
10 #define __IPIPOPTNLP_HPP__
11
12 #include "IpNLP.hpp"
13 #include "IpJournalist.hpp"
14 #include "IpNLPScaling.hpp"
15
16 namespace Ipopt
17 {
18 // forward declarations
19 class IteratesVector;
20
28 class IpoptNLP : public ReferencedObject
29 {
30 public:
33 IpoptNLP(const SmartPtr<NLPScalingObject> nlp_scaling)
34 :
35 nlp_scaling_(nlp_scaling)
36 {}
37
39 virtual ~IpoptNLP()
40 {}
42
45 virtual bool Initialize(const Journalist& jnlst,
46 const OptionsList& options,
47 const std::string& prefix)
48 {
49 bool ret = true;
50 if (IsValid(nlp_scaling_)) {
51 ret = nlp_scaling_->Initialize(jnlst, options, prefix);
52 }
53 return ret;
54 }
55
59 DECLARE_STD_EXCEPTION(Eval_Error);
61
63 virtual bool InitializeStructures(SmartPtr<Vector>& x,
64 bool init_x,
65 SmartPtr<Vector>& y_c,
66 bool init_y_c,
67 SmartPtr<Vector>& y_d,
68 bool init_y_d,
69 SmartPtr<Vector>& z_L,
70 bool init_z_L,
71 SmartPtr<Vector>& z_U,
72 bool init_z_U,
73 SmartPtr<Vector>& v_L,
74 SmartPtr<Vector>& v_U
75 ) = 0;
76
78 virtual bool GetWarmStartIterate(IteratesVector& warm_start_iterate)=0;
79
83 virtual Number f(const Vector& x) = 0;
84
86 virtual SmartPtr<const Vector> grad_f(const Vector& x) = 0;
87
89 virtual SmartPtr<const Vector> c(const Vector& x) = 0;
90
92 virtual SmartPtr<const Matrix> jac_c(const Vector& x) = 0;
93
96 virtual SmartPtr<const Vector> d(const Vector& x) = 0;
97
99 virtual SmartPtr<const Matrix> jac_d(const Vector& x) = 0;
100
102 virtual SmartPtr<const SymMatrix> h(const Vector& x,
103 Number obj_factor,
104 const Vector& yc,
105 const Vector& yd
106 ) = 0;
107
109 virtual SmartPtr<const Vector> x_L() const = 0;
110
112 virtual SmartPtr<const Matrix> Px_L() const = 0;
113
115 virtual SmartPtr<const Vector> x_U() const = 0;
116
118 virtual SmartPtr<const Matrix> Px_U() const = 0;
119
121 virtual SmartPtr<const Vector> d_L() const = 0;
122
124 virtual SmartPtr<const Matrix> Pd_L() const = 0;
125
127 virtual SmartPtr<const Vector> d_U() const = 0;
128
130 virtual SmartPtr<const Matrix> Pd_U() const = 0;
131
133 virtual SmartPtr<const VectorSpace> x_space() const = 0;
134
137 virtual SmartPtr<const SymMatrixSpace> HessianMatrixSpace() const = 0;
139
141 virtual void GetSpaces(SmartPtr<const VectorSpace>& x_space,
142 SmartPtr<const VectorSpace>& c_space,
143 SmartPtr<const VectorSpace>& d_space,
144 SmartPtr<const VectorSpace>& x_l_space,
145 SmartPtr<const MatrixSpace>& px_l_space,
146 SmartPtr<const VectorSpace>& x_u_space,
147 SmartPtr<const MatrixSpace>& px_u_space,
148 SmartPtr<const VectorSpace>& d_l_space,
149 SmartPtr<const MatrixSpace>& pd_l_space,
150 SmartPtr<const VectorSpace>& d_u_space,
151 SmartPtr<const MatrixSpace>& pd_u_space,
152 SmartPtr<const MatrixSpace>& Jac_c_space,
153 SmartPtr<const MatrixSpace>& Jac_d_space,
154 SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space) = 0;
155
158 virtual void AdjustVariableBounds(const Vector& new_x_L,
159 const Vector& new_x_U,
160 const Vector& new_d_L,
161 const Vector& new_d_U)=0;
162
165 virtual Index f_evals() const = 0;
166 virtual Index grad_f_evals() const = 0;
167 virtual Index c_evals() const = 0;
168 virtual Index jac_c_evals() const = 0;
169 virtual Index d_evals() const = 0;
170 virtual Index jac_d_evals() const = 0;
171 virtual Index h_evals() const = 0;
173
183 virtual bool objective_depends_on_mu() const
184 {
185 return false;
186 }
187
190 virtual Number f(const Vector& x, Number mu) = 0;
191
194 virtual SmartPtr<const Vector> grad_f(const Vector& x, Number mu) = 0;
195
198 virtual SmartPtr<const SymMatrix> h(const Vector& x,
199 Number obj_factor,
200 const Vector& yc,
201 const Vector& yd,
202 Number mu) = 0;
203
207 virtual SmartPtr<const SymMatrix> uninitialized_h() = 0;
209
212 virtual void FinalizeSolution(SolverReturn status,
213 const Vector& x, const Vector& z_L, const Vector& z_U,
214 const Vector& c, const Vector& d,
215 const Vector& y_c, const Vector& y_d,
216 Number obj_value,
217 const IpoptData* ip_data,
218 IpoptCalculatedQuantities* ip_cq)=0;
219
220 virtual bool IntermediateCallBack(AlgorithmMode mode,
221 Index iter, Number obj_value,
222 Number inf_pr, Number inf_du,
223 Number mu, Number d_norm,
224 Number regularization_size,
225 Number alpha_du, Number alpha_pr,
226 Index ls_trials,
227 SmartPtr<const IpoptData> ip_data,
228 SmartPtr<IpoptCalculatedQuantities> ip_cq)=0;
230
232 SmartPtr<NLPScalingObject> NLP_scaling() const
233 {
234 DBG_ASSERT(IsValid(nlp_scaling_));
235 return nlp_scaling_;
236 }
237
238 private:
239
248
250 IpoptNLP(const IpoptNLP&);
251
253 void operator=(const IpoptNLP&);
255
256 SmartPtr<NLPScalingObject> nlp_scaling_;
257 };
258
259 } // namespace Ipopt
260
261 #endif
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:579
x
Number * x
Input: Starting point Output: Optimal solution.
Definition: IpStdCInterface.h:238
Ipopt::IpoptNLP::operator=
void operator=(const IpoptNLP &)
Overloaded Equals Operator.
Ipopt::IteratesVector
Specialized CompoundVector class specifically for the algorithm iterates.
Definition: IpIteratesVector.hpp:27
Ipopt::IpoptCalculatedQuantities
Class for all IPOPT specific calculated quantities.
Definition: IpIpoptCalculatedQuantities.hpp:81
Ipopt::IpoptNLP::IpoptNLP
IpoptNLP(const SmartPtr< NLPScalingObject > nlp_scaling)
Definition: IpIpoptNLP.hpp:33
Ipopt::IpoptNLP::Pd_U
virtual SmartPtr< const Matrix > Pd_U() const =0
Permutation matrix (d_U_ -&gt; d.
Ipopt::IpoptNLP::h_evals
virtual Index h_evals() const =0
Ipopt::IpoptNLP::c_evals
virtual Index c_evals() const =0
Ipopt::IpoptNLP::HessianMatrixSpace
virtual SmartPtr< const SymMatrixSpace > HessianMatrixSpace() const =0
Accessor method to obtain the MatrixSpace for the Hessian matrix (or it&#39;s approximation) ...
IpNLP.hpp
Ipopt::IpoptNLP::GetWarmStartIterate
virtual bool GetWarmStartIterate(IteratesVector &warm_start_iterate)=0
Method accessing the GetWarmStartIterate of the NLP.
Ipopt::AlgorithmMode
AlgorithmMode
enum to indicate the mode in which the algorithm is
Definition: IpReturnCodes.hpp:43
Ipopt::IpoptNLP::uninitialized_h
virtual SmartPtr< const SymMatrix > uninitialized_h()=0
Provides a Hessian matrix from the correct matrix space with uninitialized values.
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47
Ipopt::IpoptNLP::NLP_scaling
SmartPtr< NLPScalingObject > NLP_scaling() const
Returns the scaling strategy object.
Definition: IpIpoptNLP.hpp:232
Ipopt::IpoptNLP::grad_f_evals
virtual Index grad_f_evals() const =0
Ipopt::IpoptNLP::f_evals
virtual Index f_evals() const =0
IpNLPScaling.hpp
Ipopt::IpoptNLP::~IpoptNLP
virtual ~IpoptNLP()
Default destructor.
Definition: IpIpoptNLP.hpp:39
Ipopt::IpoptNLP::h
virtual SmartPtr< const SymMatrix > h(const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd)=0
Hessian of the Lagrangian.
Ipopt::IpoptNLP::d_L
virtual SmartPtr< const Vector > d_L() const =0
Lower bounds on d.
Ipopt::IpoptNLP::nlp_scaling_
SmartPtr< NLPScalingObject > nlp_scaling_
Definition: IpIpoptNLP.hpp:256
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::ReferencedObject
ReferencedObject class.
Definition: IpReferenced.hpp:174
Ipopt::OptionsList
This class stores a list of user set options.
Definition: IpOptionsList.hpp:32
Ipopt::IpoptNLP::jac_d
virtual SmartPtr< const Matrix > jac_d(const Vector &x)=0
Jacobian Matrix for inequality constraints.
Ipopt::IpoptNLP::Initialize
virtual bool Initialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
Initialization method.
Definition: IpIpoptNLP.hpp:45
Ipopt::SolverReturn
SolverReturn
enum for the return from the optimize algorithm (obviously we need to add more)
Definition: IpAlgTypes.hpp:22
Ipopt::IpoptNLP::AdjustVariableBounds
virtual void AdjustVariableBounds(const Vector &new_x_L, const Vector &new_x_U, const Vector &new_d_L, const Vector &new_d_U)=0
Method for adapting the variable bounds.
Ipopt::IpoptNLP::jac_c_evals
virtual Index jac_c_evals() const =0
Ipopt::IpoptData
Class to organize all the data required by the algorithm.
Definition: IpIpoptData.hpp:83
Ipopt::IpoptNLP::DECLARE_STD_EXCEPTION
DECLARE_STD_EXCEPTION(Eval_Error)
thrown if there is any error evaluating values from the nlp
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::IpoptNLP::d_U
virtual SmartPtr< const Vector > d_U() const =0
Upper bounds on d.
Ipopt::IpoptNLP::objective_depends_on_mu
virtual bool objective_depends_on_mu() const
Method for telling the IpoptCalculatedQuantities class whether the objective function depends on the ...
Definition: IpIpoptNLP.hpp:183
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
Ipopt::IpoptNLP::x_U
virtual SmartPtr< const Vector > x_U() const =0
Upper bounds on x.
Ipopt::IpoptNLP::f
virtual Number f(const Vector &x)=0
Accessor methods for model data.
Ipopt::IpoptNLP::jac_c
virtual SmartPtr< const Matrix > jac_c(const Vector &x)=0
Jacobian Matrix for equality constraints.
IpJournalist.hpp
Ipopt::IpoptNLP::Px_U
virtual SmartPtr< const Matrix > Px_U() const =0
Permutation matrix (x_U_ -&gt; x.
Ipopt::IpoptNLP::x_space
virtual SmartPtr< const VectorSpace > x_space() const =0
x_space
Ipopt::IpoptNLP::Pd_L
virtual SmartPtr< const Matrix > Pd_L() const =0
Permutation matrix (d_L_ -&gt; d)
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
Ipopt::IpoptNLP::Px_L
virtual SmartPtr< const Matrix > Px_L() const =0
Permutation matrix (x_L_ -&gt; x)
Ipopt::IpoptNLP::grad_f
virtual SmartPtr< const Vector > grad_f(const Vector &x)=0
Gradient of the objective.
Ipopt::IpoptNLP::d
virtual SmartPtr< const Vector > d(const Vector &x)=0
Inequality constraint residual (reformulated as equalities with slacks.
Ipopt::IpoptNLP::IntermediateCallBack
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, SmartPtr< const IpoptData > ip_data, SmartPtr< IpoptCalculatedQuantities > ip_cq)=0
Ipopt::IpoptNLP::InitializeStructures
virtual bool InitializeStructures(SmartPtr< Vector > &x, bool init_x, SmartPtr< Vector > &y_c, bool init_y_c, SmartPtr< Vector > &y_d, bool init_y_d, SmartPtr< Vector > &z_L, bool init_z_L, SmartPtr< Vector > &z_U, bool init_z_U, SmartPtr< Vector > &v_L, SmartPtr< Vector > &v_U)=0
Initialize (create) structures for the iteration data.
Ipopt::IpoptNLP
This is the abstract base class for classes that map the traditional NLP into something that is more ...
Definition: IpIpoptNLP.hpp:28
Ipopt::IpoptNLP::x_L
virtual SmartPtr< const Vector > x_L() const =0
Lower bounds on x.
Ipopt::IpoptNLP::d_evals
virtual Index d_evals() const =0
Ipopt::IpoptNLP::c
virtual SmartPtr< const Vector > c(const Vector &x)=0
Equality constraint residual.
Ipopt::IpoptNLP::jac_d_evals
virtual Index jac_d_evals() const =0
Ipopt::IpoptNLP::FinalizeSolution
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)=0
Ipopt::IpoptNLP::GetSpaces
virtual void 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)=0
Accessor method for vector/matrix spaces pointers.