Ipopt 3.11.9
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 1861 2010-12-21 21:34:47Z andreasw $
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
16namespace Ipopt
17{
18 // forward declarations
19 class IteratesVector;
20
29 {
30 public:
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
61
64 bool init_x,
66 bool init_y_c,
68 bool init_y_d,
70 bool init_z_L,
72 bool init_z_U,
75 ) = 0;
76
78 virtual bool GetWarmStartIterate(IteratesVector& warm_start_iterate)=0;
79
83 virtual Number f(const Vector& x) = 0;
84
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
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
136
142 SmartPtr<const MatrixSpace>& px_l_space,
144 SmartPtr<const MatrixSpace>& px_u_space,
146 SmartPtr<const MatrixSpace>& pd_l_space,
148 SmartPtr<const MatrixSpace>& pd_u_space,
149 SmartPtr<const MatrixSpace>& Jac_c_space,
150 SmartPtr<const MatrixSpace>& Jac_d_space,
151 SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space) = 0;
152
155 virtual void AdjustVariableBounds(const Vector& new_x_L,
156 const Vector& new_x_U,
157 const Vector& new_d_L,
158 const Vector& new_d_U)=0;
159
162 virtual Index f_evals() const = 0;
163 virtual Index grad_f_evals() const = 0;
164 virtual Index c_evals() const = 0;
165 virtual Index jac_c_evals() const = 0;
166 virtual Index d_evals() const = 0;
167 virtual Index jac_d_evals() const = 0;
168 virtual Index h_evals() const = 0;
170
180 virtual bool objective_depends_on_mu() const
181 {
182 return false;
183 }
184
187 virtual Number f(const Vector& x, Number mu) = 0;
188
191 virtual SmartPtr<const Vector> grad_f(const Vector& x, Number mu) = 0;
192
196 Number obj_factor,
197 const Vector& yc,
198 const Vector& yd,
199 Number mu) = 0;
200
206
209 virtual void FinalizeSolution(SolverReturn status,
210 const Vector& x, const Vector& z_L, const Vector& z_U,
211 const Vector& c, const Vector& d,
212 const Vector& y_c, const Vector& y_d,
213 Number obj_value,
214 const IpoptData* ip_data,
216
218 Index iter, Number obj_value,
219 Number inf_pr, Number inf_du,
220 Number mu, Number d_norm,
221 Number regularization_size,
222 Number alpha_du, Number alpha_pr,
223 Index ls_trials,
227
230 {
232 return nlp_scaling_;
233 }
234
235 private:
236
245
248
250 void operator=(const IpoptNLP&);
252
254 };
255
256} // namespace Ipopt
257
258#endif
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
AlgorithmMode
enum to indicate the mode in which the algorithm is
Number * x
Input: Starting point Output: Optimal solution.
Class for all IPOPT specific calculated quantities.
Class to organize all the data required by the algorithm.
Definition: IpIpoptData.hpp:84
This is the abstract base class for classes that map the traditional NLP into something that is more ...
Definition: IpIpoptNLP.hpp:29
virtual SmartPtr< const SymMatrix > uninitialized_h()=0
Provides a Hessian matrix from the correct matrix space with uninitialized values.
virtual SmartPtr< const Matrix > Px_U() const =0
Permutation matrix (x_U_ -> x.
virtual bool objective_depends_on_mu() const
Method for telling the IpoptCalculatedQuantities class whether the objective function depends on the ...
Definition: IpIpoptNLP.hpp:180
virtual SmartPtr< const SymMatrix > h(const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd, Number mu)=0
Replacement for the default Lagrangian Hessian method which knows about the barrier parameter.
IpoptNLP(const IpoptNLP &)
Copy Constructor.
virtual SmartPtr< const Matrix > Pd_L() const =0
Permutation matrix (d_L_ -> d)
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.
virtual SmartPtr< const Matrix > jac_c(const Vector &x)=0
Jacobian Matrix for equality constraints.
virtual Index f_evals() const =0
DECLARE_STD_EXCEPTION(Eval_Error)
thrown if there is any error evaluating values from the nlp
virtual SmartPtr< const Vector > x_U() const =0
Upper bounds on x.
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
void operator=(const IpoptNLP &)
Overloaded Equals Operator.
virtual SmartPtr< const Vector > c(const Vector &x)=0
Equality constraint residual.
virtual Number f(const Vector &x)=0
Accessor methods for model data.
virtual Index d_evals() const =0
virtual ~IpoptNLP()
Default destructor.
Definition: IpIpoptNLP.hpp:39
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
virtual bool GetWarmStartIterate(IteratesVector &warm_start_iterate)=0
Method accessing the GetWarmStartIterate of the NLP.
virtual SmartPtr< const Matrix > Pd_U() const =0
Permutation matrix (d_U_ -> d.
virtual SmartPtr< const Vector > x_L() const =0
Lower bounds on x.
virtual SmartPtr< const SymMatrix > h(const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd)=0
Hessian of the Lagrangian.
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.
virtual SmartPtr< const Vector > grad_f(const Vector &x)=0
Gradient of the objective.
virtual SmartPtr< const Vector > d_L() const =0
Lower bounds on d.
virtual Index c_evals() const =0
virtual SmartPtr< const Matrix > Px_L() const =0
Permutation matrix (x_L_ -> x)
virtual SmartPtr< const Vector > grad_f(const Vector &x, Number mu)=0
Replacement for the default objective gradient method which knows about the barrier parameter
virtual SmartPtr< const SymMatrixSpace > HessianMatrixSpace() const =0
Accessor method to obtain the MatrixSpace for the Hessian matrix (or it's approximation)
virtual Index jac_d_evals() const =0
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.
IpoptNLP(const SmartPtr< NLPScalingObject > nlp_scaling)
Definition: IpIpoptNLP.hpp:33
SmartPtr< NLPScalingObject > nlp_scaling_
Definition: IpIpoptNLP.hpp:253
virtual bool Initialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
Initialization method.
Definition: IpIpoptNLP.hpp:45
virtual Number f(const Vector &x, Number mu)=0
Replacement for the default objective function method which knows about the barrier parameter.
virtual SmartPtr< const Vector > d_U() const =0
Upper bounds on d.
virtual SmartPtr< const Vector > d(const Vector &x)=0
Inequality constraint residual (reformulated as equalities with slacks.
SmartPtr< NLPScalingObject > NLP_scaling() const
Returns the scaling strategy object.
Definition: IpIpoptNLP.hpp:229
virtual SmartPtr< const Matrix > jac_d(const Vector &x)=0
Jacobian Matrix for inequality constraints.
virtual Index grad_f_evals() const =0
virtual Index jac_c_evals() const =0
virtual Index h_evals() const =0
Specialized CompoundVector class specifically for the algorithm iterates.
Class responsible for all message output.
This class stores a list of user set options.
ReferencedObject class.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:183
Vector Base Class.
Definition: IpVector.hpp:48
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:589
SolverReturn
enum for the return from the optimize algorithm (obviously we need to add more)
Definition: IpAlgTypes.hpp:22
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
double Number
Type of all numbers.
Definition: IpTypes.hpp:17