Ipopt Documentation  
 
Loading...
Searching...
No Matches
IpNLP.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// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
6
7#ifndef __IPNLP_HPP__
8#define __IPNLP_HPP__
9
10#include "IpUtils.hpp"
11#include "IpVector.hpp"
12#include "IpSmartPtr.hpp"
13#include "IpMatrix.hpp"
14#include "IpSymMatrix.hpp"
15#include "IpOptionsList.hpp"
16#include "IpAlgTypes.hpp"
17#include "IpReturnCodes.hpp"
18
19namespace Ipopt
20{
21// forward declarations
22class IpoptData;
24class IteratesVector;
25
42{
43public:
46
48 { }
49
51 virtual ~NLP()
52 { }
53
54
57 DECLARE_STD_EXCEPTION(USER_SCALING_NOT_IMPLEMENTED);
60
63
64 virtual bool ProcessOptions(
65 const OptionsList& /*options*/,
66 const std::string& /*prefix*/
67 )
68 {
69 return true;
70 }
71
76 virtual bool GetSpaces(
88 SmartPtr<const MatrixSpace>& Jac_c_space,
89 SmartPtr<const MatrixSpace>& Jac_d_space,
90 SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space
91 ) = 0;
92
95 const Matrix& Px_L,
96 Vector& x_L,
97 const Matrix& Px_U,
98 Vector& x_U,
99 const Matrix& Pd_L,
100 Vector& d_L,
101 const Matrix& Pd_U,
102 Vector& d_U
103 ) = 0;
104
106 // ToDo it might not make sense to ask for initial values for v_L and v_U?
107 virtual bool GetStartingPoint(
109 bool need_x,
111 bool need_y_c,
113 bool need_y_d,
115 bool need_z_L,
117 bool need_z_U
118 ) = 0;
119
126 IteratesVector& /*warm_start_iterate*/
127 )
128 {
129 return false;
130 }
131
132
135 virtual bool Eval_f(
136 const Vector& x,
137 Number& f
138 ) = 0;
139
140 virtual bool Eval_grad_f(
141 const Vector& x,
142 Vector& g_f
143 ) = 0;
144
145 virtual bool Eval_c(
146 const Vector& x,
147 Vector& c
148 ) = 0;
149
150 virtual bool Eval_jac_c(
151 const Vector& x,
152 Matrix& jac_c
153 ) = 0;
154
155 virtual bool Eval_d(
156 const Vector& x,
157 Vector& d
158 ) = 0;
159
160 virtual bool Eval_jac_d(
161 const Vector& x,
162 Matrix& jac_d
163 ) = 0;
164
165 virtual bool Eval_h(
166 const Vector& x,
167 Number obj_factor,
168 const Vector& yc,
169 const Vector& yd,
170 SymMatrix& h
171 ) = 0;
173
178
184 virtual void FinalizeSolution(
185 SolverReturn /*status*/,
186 const Vector& /*x*/,
187 const Vector& /*z_L*/,
188 const Vector& /*z_U*/,
189 const Vector& /*c*/,
190 const Vector& /*d*/,
191 const Vector& /*y_c*/,
192 const Vector& /*y_d*/,
193 Number /*obj_value*/,
194 const IpoptData* /*ip_data*/,
196 )
197 { }
198
218 AlgorithmMode /*mode*/,
219 Index /*iter*/,
220 Number /*obj_value*/,
221 Number /*inf_pr*/,
222 Number /*inf_du*/,
223 Number /*mu*/,
224 Number /*d_norm*/,
225 Number /*regularization_size*/,
226 Number /*alpha_du*/,
227 Number /*alpha_pr*/,
228 Index /*ls_trials*/,
229 const IpoptData* /*ip_data*/,
231 )
232 {
233 return true;
234 }
235
236
243 const SmartPtr<const VectorSpace> /*x_space*/,
244 const SmartPtr<const VectorSpace> /*c_space*/,
245 const SmartPtr<const VectorSpace> /*d_space*/,
246 Number& /*obj_scaling*/,
247 SmartPtr<Vector>& /*x_scaling*/,
248 SmartPtr<Vector>& /*c_scaling*/,
249 SmartPtr<Vector>& /*d_scaling*/
250 ) const
251 {
252 THROW_EXCEPTION(USER_SCALING_NOT_IMPLEMENTED,
253 "You have set options for user provided scaling, but have not implemented GetScalingParameters in the NLP interface");
254 }
255
256
274 SmartPtr<VectorSpace>& approx_space,
275 SmartPtr<Matrix>& P_approx
276 )
277 {
278 approx_space = NULL;
279 P_approx = NULL;
280 }
281
282private:
292
294 const NLP&
295 );
296
299 const NLP&
300 );
302};
303
304} // namespace Ipopt
305
306#endif
#define THROW_EXCEPTION(__except_type, __msg)
Class for all IPOPT specific calculated quantities.
Class to organize all the data required by the algorithm.
Specialized CompoundVector class specifically for the algorithm iterates.
Matrix Base Class.
Definition IpMatrix.hpp:28
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)=0
Method for obtaining the bounds information.
virtual bool Eval_h(const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd, SymMatrix &h)=0
DECLARE_STD_EXCEPTION(USER_SCALING_NOT_IMPLEMENTED)
Exceptions.
virtual bool Eval_grad_f(const Vector &x, Vector &g_f)=0
DECLARE_STD_EXCEPTION(INVALID_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)=0
Method for obtaining the starting point for all the iterates.
NLP()
Default constructor.
Definition IpNLP.hpp:47
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)=0
Method for creating the derived vector / matrix types.
virtual bool Eval_d(const Vector &x, Vector &d)=0
NLP(const NLP &)
Copy Constructor.
virtual bool ProcessOptions(const OptionsList &, const std::string &)
Overload if you want the chance to process options or parameters that may be specific to the NLP.
Definition IpNLP.hpp:64
virtual void GetScalingParameters(const SmartPtr< const VectorSpace >, const SmartPtr< const VectorSpace >, const SmartPtr< const VectorSpace >, Number &, SmartPtr< Vector > &, SmartPtr< Vector > &, SmartPtr< Vector > &) const
Routines to get the scaling parameters.
Definition IpNLP.hpp:242
virtual bool Eval_c(const Vector &x, Vector &c)=0
void operator=(const NLP &)
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.
Definition IpNLP.hpp:273
virtual bool IntermediateCallBack(AlgorithmMode, Index, Number, Number, Number, Number, Number, Number, Number, Number, Index, const IpoptData *, IpoptCalculatedQuantities *)
This method is called once per iteration, after the iteration summary output has been printed.
Definition IpNLP.hpp:217
virtual ~NLP()
Default destructor.
Definition IpNLP.hpp:51
virtual bool Eval_jac_d(const Vector &x, Matrix &jac_d)=0
virtual bool Eval_f(const Vector &x, Number &f)=0
virtual bool GetWarmStartIterate(IteratesVector &)
Method for obtaining an entire iterate as a warmstart point.
Definition IpNLP.hpp:125
virtual bool Eval_jac_c(const Vector &x, Matrix &jac_c)=0
virtual void FinalizeSolution(SolverReturn, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, Number, const IpoptData *, IpoptCalculatedQuantities *)
This method is called at the very end of the optimization.
Definition IpNLP.hpp:184
This class stores a list of user set options.
Template class for Smart Pointers.
This is the base class for all derived symmetric matrix types.
Vector Base Class.
Definition IpVector.hpp:48
#define IPOPTLIB_EXPORT
Definition config.h:94
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
ipindex Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition IpTypes.hpp:17
AlgorithmMode
enum to indicate the mode in which the algorithm is