Ipopt Documentation  
 
Loading...
Searching...
No Matches
IpOrigIpoptNLP.hpp
Go to the documentation of this file.
1// Copyright (C) 2004, 2010 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 __IPORIGIPOPTNLP_HPP__
8#define __IPORIGIPOPTNLP_HPP__
9
10#include "IpIpoptNLP.hpp"
11#include "IpException.hpp"
13
14namespace Ipopt
15{
16
19{
20 EXACT = 0,
22};
23
26{
29};
30
39{
40public:
43
45 const SmartPtr<const Journalist>& jnlst,
46 const SmartPtr<NLP>& nlp,
47 const SmartPtr<NLPScalingObject>& nlp_scaling
48 );
49
51 virtual ~OrigIpoptNLP();
53
54 virtual bool Initialize(
55 const Journalist& jnlst,
56 const OptionsList& options,
57 const std::string& prefix
58 );
59
63 bool init_x,
65 bool init_y_c,
67 bool init_y_d,
69 bool init_z_L,
71 bool init_z_U,
74 );
75
77 virtual bool GetWarmStartIterate(
78 IteratesVector& warm_start_iterate
79 )
80 {
81 return nlp_->GetWarmStartIterate(warm_start_iterate);
82 }
83
86
87 virtual Number f(
88 const Vector& x
89 );
90
94 virtual Number f(
95 const Vector& x,
96 Number mu
97 );
98
101 const Vector& x
102 );
103
108 const Vector& x,
109 Number mu
110 );
111
114 const Vector& x
115 );
116
119 const Vector& x
120 );
121
126 const Vector& x
127 );
128
131 const Vector& x
132 );
133
136 const Vector& x,
137 Number obj_factor,
138 const Vector& yc,
139 const Vector& yd
140 );
141
146 const Vector& x,
147 Number obj_factor,
148 const Vector& yc,
149 const Vector& yd,
150 Number mu
151 );
152
159
162 {
163 return x_L_;
164 }
165
168 {
169 return Px_L_;
170 }
171
174 {
175 return x_U_;
176 }
177
180 {
181 return Px_U_;
182 }
183
186 {
187 return d_L_;
188 }
189
192 {
193 return Pd_L_;
194 }
195
198 {
199 return d_U_;
200 }
201
204 {
205 return Pd_U_;
206 }
207
209 {
210 return h_space_;
211 }
212
214 {
215 return x_space_;
216 }
218
220 virtual void GetSpaces(
225 SmartPtr<const MatrixSpace>& px_l_space,
227 SmartPtr<const MatrixSpace>& px_u_space,
229 SmartPtr<const MatrixSpace>& pd_l_space,
231 SmartPtr<const MatrixSpace>& pd_u_space,
232 SmartPtr<const MatrixSpace>& Jac_c_space,
233 SmartPtr<const MatrixSpace>& Jac_d_space,
234 SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space
235 );
236
240 const Vector& new_x_L,
241 const Vector& new_x_U,
242 const Vector& new_d_L,
243 const Vector& new_d_U
244 );
245
248 virtual Index f_evals() const
249 {
250 return f_evals_;
251 }
252 virtual Index grad_f_evals() const
253 {
254 return grad_f_evals_;
255 }
256 virtual Index c_evals() const
257 {
258 return c_evals_;
259 }
260 virtual Index jac_c_evals() const
261 {
262 return jac_c_evals_;
263 }
264 virtual Index d_evals() const
265 {
266 return d_evals_;
267 }
268 virtual Index jac_d_evals() const
269 {
270 return jac_d_evals_;
271 }
272 virtual Index h_evals() const
273 {
274 return h_evals_;
275 }
277
281 SolverReturn status,
282 const Vector& x,
283 const Vector& z_L,
284 const Vector& z_U,
285 const Vector& c,
286 const Vector& d,
287 const Vector& y_c,
288 const Vector& y_d,
289 Number obj_value,
290 const IpoptData* ip_data,
292 );
293
295 AlgorithmMode mode,
296 Index iter,
297 Number obj_value,
298 Number inf_pr,
299 Number inf_du,
300 Number mu,
301 Number d_norm,
302 Number regularization_size,
303 Number alpha_du,
304 Number alpha_pr,
305 Index ls_trials,
308 );
310
312 static void RegisterOptions(
314 );
315
318 {
319 return nlp_;
320 }
321
324
326
328 Journalist& jnlst,
329 EJournalLevel level,
330 EJournalCategory category
331 ) const;
332
333 const TimedTask& f_eval_time() const
334 {
335 return f_eval_time_;
336 }
338 {
339 return grad_f_eval_time_;
340 }
341 const TimedTask& c_eval_time() const
342 {
343 return c_eval_time_;
344 }
346 {
347 return jac_c_eval_time_;
348 }
349 const TimedTask& d_eval_time() const
350 {
351 return d_eval_time_;
352 }
354 {
355 return jac_d_eval_time_;
356 }
357 const TimedTask& h_eval_time() const
358 {
359 return h_eval_time_;
360 }
361
366
367private:
370
373
390
395
398
400
403
406
411
416
421
426
429
432
435
438
441
444
447
450
453
456
460
471
473
476 const OrigIpoptNLP&
477 );
478
481 const OrigIpoptNLP&
482 );
484
487
493 Number bound_relax_factor,
494 Vector& bounds
495 );
496
499 const Vector& x
500 );
502
505
508
513
518
521
524
529
534
539
543
554
557
568};
569
570} // namespace Ipopt
571
572#endif
AlgorithmMode
enum to indicate the mode in which the algorithm is
Templated class for Cached Results.
Class for all IPOPT specific calculated quantities.
Class to organize all the data required by the algorithm.
Definition: IpIpoptData.hpp:98
This is the abstract base class for classes that map the traditional NLP into something that is more ...
Definition: IpIpoptNLP.hpp:28
Specialized CompoundVector class specifically for the algorithm iterates.
Class responsible for all message output.
This class stores a list of user set options.
This class maps the traditional NLP into something that is more useful by Ipopt.
void operator=(const OrigIpoptNLP &)
Overloaded Assignment Operator.
SmartPtr< const Matrix > Px_U_
Permutation matrix (x_U_ -> x)
virtual Number f(const Vector &x)
Accessor methods for model data.
OrigIpoptNLP()
Default Constructor.
virtual SmartPtr< const Matrix > Px_L() const
Permutation matrix (x_L_ -> x)
SmartPtr< const VectorSpace > d_l_space_
CachedResults< Number > f_cache_
Objective function.
CachedResults< SmartPtr< const SymMatrix > > h_cache_
Hessian of the lagrangian (current iteration)
CachedResults< SmartPtr< const Vector > > unscaled_x_cache_
Unscaled version of x vector.
SmartPtr< const VectorSpace > x_u_space_
SmartPtr< const MatrixSpace > px_l_space_
Number TotalFunctionEvaluationCpuTime() const
SmartPtr< const Vector > orig_x_L_
Original unmodified lower bounds on x.
bool jac_d_constant_
Flag indicating if we need to ask for inequality constraint Jacobians only once.
const TimedTask & d_eval_time() const
virtual SmartPtr< const Vector > grad_f(const Vector &x, Number mu)
Gradient of the objective (depending in mu) - incorrect version for OrigIpoptNLP.
virtual bool GetWarmStartIterate(IteratesVector &warm_start_iterate)
Method accessing the GetWarmStartIterate of the NLP.
virtual SmartPtr< const Vector > d(const Vector &x)
Inequality constraint residual (reformulated as equalities with slacks)
CachedResults< SmartPtr< const Matrix > > jac_d_cache_
Jacobian Matrix for inequality constraints (current iteration)
virtual SmartPtr< const Matrix > jac_d(const Vector &x)
Jacobian Matrix for inequality constraints.
SmartPtr< const Vector > x_L_
Lower bounds on x.
CachedResults< SmartPtr< const Matrix > > jac_c_cache_
Jacobian Matrix for equality constraints (current iteration)
virtual SmartPtr< const Matrix > Pd_L() const
Permutation matrix (d_L_ -> d)
SmartPtr< NLP > nlp_
Pointer to the NLP.
const TimedTask & f_eval_time() const
bool honor_original_bounds_
Flag indicating whether the primal variables should be projected back into original bounds are optimi...
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
Called to register the options.
virtual SmartPtr< const Matrix > jac_c(const Vector &x)
Jacobian Matrix for equality constraints.
virtual SmartPtr< const SymMatrix > h(const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd, Number mu)
Hessian of the Lagrangian (depending in mu) - incorrect version for OrigIpoptNLP.
SmartPtr< const Matrix > Pd_U_
Permutation matrix (d_U_ -> d)
HessianApproximationType hessian_approximation_
Flag indicating what Hessian information is to be used.
virtual Index grad_f_evals() const
SmartPtr< NLP > nlp()
Accessor method to the underlying NLP.
const TimedTask & grad_f_eval_time() const
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)
virtual SmartPtr< const SymMatrix > h(const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd)
Hessian of the Lagrangian.
bool initialized_
Flag indicating if initialization method has been called.
void relax_bounds(Number bound_relax_factor, Vector &bounds)
relax the bounds by a relative move of relax_bound_factor.
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)
Accessor method for vector/matrix spaces pointers.
bool hessian_constant_
Flag indicating if we need to ask for Hessian only once.
virtual Index jac_c_evals() const
SmartPtr< const MatrixSpace > jac_d_space_
SmartPtr< const Vector > orig_x_U_
Original unmodified upper bounds on x.
virtual SmartPtr< const Matrix > Pd_U() const
Permutation matrix (d_U_ -> d)
virtual SmartPtr< const Vector > grad_f(const Vector &x)
Gradient of the objective.
CachedResults< SmartPtr< const Vector > > grad_f_cache_
Gradient of the objective function.
virtual ~OrigIpoptNLP()
Destructor.
virtual SmartPtr< const Vector > x_U() const
Upper bounds on x.
HessianApproximationSpace hessian_approximation_space_
Flag indicating in which space Hessian is to be approximated.
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)
Solution Routines - overloaded from IpoptNLP.
SmartPtr< const Vector > x_U_
Upper bounds on x.
virtual void AdjustVariableBounds(const Vector &new_x_L, const Vector &new_x_U, const Vector &new_d_L, const Vector &new_d_U)
Method for adapting the variable bounds.
SmartPtr< const Vector > d_L_
Lower bounds on d.
virtual SmartPtr< const Vector > d_L() const
Lower bounds on d.
SmartPtr< const Matrix > Pd_L_
Permutation matrix (d_L_ -> d)
virtual Index h_evals() const
virtual SmartPtr< const Vector > c(const Vector &x)
Equality constraint residual.
virtual SmartPtr< const Matrix > Px_U() const
Permutation matrix (x_U_ -> x)
SmartPtr< const VectorSpace > d_u_space_
virtual SmartPtr< const SymMatrixSpace > HessianMatrixSpace() const
Accessor method to obtain the MatrixSpace for the Hessian matrix (or it's approximation)
bool jac_c_constant_
Flag indicating if we need to ask for equality constraint Jacobians only once.
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)
Initialize (create) structures for the iteration data.
Number TotalFunctionEvaluationWallclockTime() const
SmartPtr< const Vector > get_unscaled_x(const Vector &x)
Method for getting the unscaled version of the x vector.
virtual SmartPtr< const Vector > d_U() const
Upper bounds on d.
CachedResults< SmartPtr< const Vector > > c_cache_
Equality constraint residuals.
virtual Number f(const Vector &x, Number mu)
Objective value (depending in mu) - incorrect version for OrigIpoptNLP.
void ResetTimes()
Reset the timing statistics.
virtual bool Initialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
Initialization method.
SmartPtr< const MatrixSpace > pd_u_space_
SmartPtr< const SymMatrixSpace > h_space_
SmartPtr< const MatrixSpace > scaled_jac_d_space_
Number TotalFunctionEvaluationSysTime() const
bool check_derivatives_for_naninf_
Flag indicating whether it is desired to check if there are Nan or Inf entries in first and second de...
SmartPtr< const Vector > d_U_
Upper bounds on d.
SmartPtr< const VectorSpace > x_space_
Necessary Vector/Matrix spaces.
SmartPtr< const Matrix > Px_L_
Permutation matrix (x_L_ -> x)
virtual Index f_evals() const
const TimedTask & jac_d_eval_time() const
virtual Index d_evals() const
Number bound_relax_factor_
relaxation factor for the bounds
const TimedTask & jac_c_eval_time() const
void PrintTimingStatistics(Journalist &jnlst, EJournalLevel level, EJournalCategory category) const
SmartPtr< const VectorSpace > c_space_
const TimedTask & h_eval_time() const
SmartPtr< const SymMatrixSpace > scaled_h_space_
virtual SmartPtr< const Vector > x_L() const
Lower bounds on x.
SmartPtr< const MatrixSpace > pd_l_space_
virtual Index c_evals() const
SmartPtr< const Journalist > jnlst_
Journalist.
SmartPtr< const VectorSpace > d_space_
bool warm_start_same_structure_
Flag indicating whether the TNLP with identical structure has already been solved before.
virtual SmartPtr< const SymMatrix > uninitialized_h()
Provides a Hessian matrix from the correct matrix space with uninitialized values.
SmartPtr< const VectorSpace > x_l_space_
SmartPtr< const MatrixSpace > jac_c_space_
SmartPtr< const MatrixSpace > scaled_jac_c_space_
OrigIpoptNLP(const SmartPtr< const Journalist > &jnlst, const SmartPtr< NLP > &nlp, const SmartPtr< NLPScalingObject > &nlp_scaling)
Constructor.
virtual SmartPtr< const VectorSpace > x_space() const
x_space
virtual Index jac_d_evals() const
OrigIpoptNLP(const OrigIpoptNLP &)
Copy Constructor.
CachedResults< SmartPtr< const Vector > > d_cache_
Inequality constraint residual (reformulated as equalities with slacks.
const TimedTask & c_eval_time() const
SmartPtr< const MatrixSpace > px_u_space_
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
This class is used to collect timing information for a particular task.
Definition: IpTimedTask.hpp:17
Vector Base Class.
Definition: IpVector.hpp:48
#define IPOPTLIB_EXPORT
This file contains a base class for all exceptions and a set of macros to help with exceptions.
HessianApproximationSpace
enumeration for the Hessian approximation space.
@ NONLINEAR_VARS
HessianApproximationType
enumeration for the Hessian information type.
@ LIMITED_MEMORY
SolverReturn
enum for the return from the optimize algorithm
Definition: IpAlgTypes.hpp:20
EJournalCategory
Category Selection Enum.
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
EJournalLevel
Print Level Enum.
double Number
Type of all numbers.
Definition: IpTypes.hpp:15