Ipopt Documentation  
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"
12 #include "IpTimingStatistics.hpp"
13 
14 namespace Ipopt
15 {
16 
19 {
20  EXACT = 0,
22 };
23 
26 {
29 };
30 
66 {
67 public:
69 
72  const SmartPtr<const Journalist>& jnlst,
73  const SmartPtr<NLP>& nlp,
74  const SmartPtr<NLPScalingObject>& nlp_scaling,
75  TimingStatistics& timing_statistics
76  );
77 
79  virtual ~OrigIpoptNLP();
81 
82  virtual bool Initialize(
83  const Journalist& jnlst,
84  const OptionsList& options,
85  const std::string& prefix
86  );
87 
89  virtual bool InitializeStructures(
91  bool init_x,
92  SmartPtr<Vector>& y_c,
93  bool init_y_c,
94  SmartPtr<Vector>& y_d,
95  bool init_y_d,
96  SmartPtr<Vector>& z_L,
97  bool init_z_L,
98  SmartPtr<Vector>& z_U,
99  bool init_z_U,
100  SmartPtr<Vector>& v_L,
101  SmartPtr<Vector>& v_U
102  );
103 
105  virtual bool GetWarmStartIterate(
106  IteratesVector& warm_start_iterate
107  )
108  {
109  return nlp_->GetWarmStartIterate(warm_start_iterate);
110  }
111 
113 
115  virtual Number f(
116  const Vector& x
117  );
118 
122  virtual Number f(
123  const Vector& x,
124  Number mu
125  );
126 
128  virtual SmartPtr<const Vector> grad_f(
129  const Vector& x
130  );
131 
135  virtual SmartPtr<const Vector> grad_f(
136  const Vector& x,
137  Number mu
138  );
139 
141  virtual SmartPtr<const Vector> c(
142  const Vector& x
143  );
144 
146  virtual SmartPtr<const Matrix> jac_c(
147  const Vector& x
148  );
149 
153  virtual SmartPtr<const Vector> d(
154  const Vector& x
155  );
156 
158  virtual SmartPtr<const Matrix> jac_d(
159  const Vector& x
160  );
161 
163  virtual SmartPtr<const SymMatrix> h(
164  const Vector& x,
165  Number obj_factor,
166  const Vector& yc,
167  const Vector& yd
168  );
169 
173  virtual SmartPtr<const SymMatrix> h(
174  const Vector& x,
175  Number obj_factor,
176  const Vector& yc,
177  const Vector& yd,
178  Number mu
179  );
180 
186  virtual SmartPtr<const SymMatrix> uninitialized_h();
187 
189  virtual SmartPtr<const Vector> x_L() const
190  {
191  return x_L_;
192  }
193 
195  virtual SmartPtr<const Matrix> Px_L() const
196  {
197  return Px_L_;
198  }
199 
206  {
207  return orig_x_L_;
208  }
209 
211  virtual SmartPtr<const Vector> x_U() const
212  {
213  return x_U_;
214  }
215 
217  virtual SmartPtr<const Matrix> Px_U() const
218  {
219  return Px_U_;
220  }
221 
228  {
229  return orig_x_U_;
230  }
231 
233  virtual SmartPtr<const Vector> d_L() const
234  {
235  return d_L_;
236  }
237 
239  virtual SmartPtr<const Matrix> Pd_L() const
240  {
241  return Pd_L_;
242  }
243 
250  {
251  return orig_d_L_;
252  }
253 
255  virtual SmartPtr<const Vector> d_U() const
256  {
257  return d_U_;
258  }
259 
261  virtual SmartPtr<const Matrix> Pd_U() const
262  {
263  return Pd_U_;
264  }
265 
272  {
273  return orig_d_U_;
274  }
275 
277  {
278  return h_space_;
279  }
280 
282  {
283  return x_space_;
284  }
286 
288  virtual void GetSpaces(
292  SmartPtr<const VectorSpace>& x_l_space,
293  SmartPtr<const MatrixSpace>& px_l_space,
294  SmartPtr<const VectorSpace>& x_u_space,
295  SmartPtr<const MatrixSpace>& px_u_space,
296  SmartPtr<const VectorSpace>& d_l_space,
297  SmartPtr<const MatrixSpace>& pd_l_space,
298  SmartPtr<const VectorSpace>& d_u_space,
299  SmartPtr<const MatrixSpace>& pd_u_space,
300  SmartPtr<const MatrixSpace>& Jac_c_space,
301  SmartPtr<const MatrixSpace>& Jac_d_space,
302  SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space
303  );
304 
307  virtual void AdjustVariableBounds(
308  const Vector& new_x_L,
309  const Vector& new_x_U,
310  const Vector& new_d_L,
311  const Vector& new_d_U
312  );
313 
315  virtual Index f_evals() const
317  {
318  return f_evals_;
319  }
320  virtual Index grad_f_evals() const
321  {
322  return grad_f_evals_;
323  }
324  virtual Index c_evals() const
325  {
326  return c_evals_;
327  }
328  virtual Index jac_c_evals() const
329  {
330  return jac_c_evals_;
331  }
332  virtual Index d_evals() const
333  {
334  return d_evals_;
335  }
336  virtual Index jac_d_evals() const
337  {
338  return jac_d_evals_;
339  }
340  virtual Index h_evals() const
341  {
342  return h_evals_;
343  }
345 
347  void FinalizeSolution(
349  SolverReturn status,
350  const Vector& x,
351  const Vector& z_L,
352  const Vector& z_U,
353  const Vector& c,
354  const Vector& d,
355  const Vector& y_c,
356  const Vector& y_d,
357  Number obj_value,
358  const IpoptData* ip_data,
360  );
361 
362  bool IntermediateCallBack(
363  AlgorithmMode mode,
364  Index iter,
365  Number obj_value,
366  Number inf_pr,
367  Number inf_du,
368  Number mu,
369  Number d_norm,
370  Number regularization_size,
371  Number alpha_du,
372  Number alpha_pr,
373  Index ls_trials,
376  );
378 
380  static void RegisterOptions(
382  );
383 
386  {
387  return nlp_;
388  }
389 
390 private:
393 
396 
413 
418 
420 
423 
426 
429 
434 
439 
444 
449 
452 
455 
458 
461 
464 
467 
470 
473 
476 
479 
482 
485 
489 
499 
501  OrigIpoptNLP();
502 
504  OrigIpoptNLP(
505  const OrigIpoptNLP&
506  );
507 
509  void operator=(
510  const OrigIpoptNLP&
511  );
513 
515 
521  void relax_bounds(
522  Number bound_relax_factor,
523  Vector& bounds
524  );
525 
527  SmartPtr<const Vector> get_unscaled_x(
528  const Vector& x
529  );
531 
533 
537 
540 
545 
550 
553 
556 
561 
566 
571 
576 
580 
582  Index f_evals_;
591 
594 
596  TimingStatistics& timing_statistics_;
599 };
600 
601 } // namespace Ipopt
602 
603 #endif
CachedResults< SmartPtr< const Vector > > c_cache_
Equality constraint residuals.
SmartPtr< const Vector > orig_x_U_
Original unmodified upper bounds on x.
bool jac_d_constant_
Flag indicating if we need to ask for inequality constraint Jacobians only once.
Specialized CompoundVector class specifically for the algorithm iterates.
Class for all IPOPT specific calculated quantities.
CachedResults< SmartPtr< const Vector > > d_cache_
Inequality constraint residual (reformulated as equalities with slacks.
virtual SmartPtr< const Vector > d_L() const
Scaled lower bounds on d.
SmartPtr< const Matrix > Px_L_
Permutation matrix (x_L_ -> x)
bool jac_c_constant_
Flag indicating if we need to ask for equality constraint Jacobians only once.
virtual SmartPtr< const Vector > x_L() const
Scaled lower bounds on x.
SmartPtr< const MatrixSpace > jac_d_space_
virtual SmartPtr< const Vector > orig_x_L() const
Original unscaled lower bounds on x.
#define IPOPTLIB_EXPORT
Definition: config.h:94
SmartPtr< const MatrixSpace > px_u_space_
virtual bool GetWarmStartIterate(IteratesVector &warm_start_iterate)
Method accessing the GetWarmStartIterate of the NLP.
AlgorithmMode
enum to indicate the mode in which the algorithm is
Vector Base Class.
Definition: IpVector.hpp:47
SmartPtr< const VectorSpace > d_l_space_
SmartPtr< const SymMatrixSpace > scaled_h_space_
SmartPtr< const VectorSpace > x_u_space_
SmartPtr< const MatrixSpace > scaled_jac_c_space_
bool initialized_
Flag indicating if initialization method has been called.
SmartPtr< const VectorSpace > x_l_space_
CachedResults< SmartPtr< const Vector > > unscaled_x_cache_
Unscaled version of x vector.
HessianApproximationType hessian_approximation_
Flag indicating what Hessian information is to be used.
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
SmartPtr< const MatrixSpace > scaled_jac_d_space_
CachedResults< SmartPtr< const Matrix > > jac_d_cache_
Jacobian Matrix for inequality constraints (current iteration)
bool honor_original_bounds_
Flag indicating whether the primal variables should be projected back into original bounds are optimi...
This file contains a base class for all exceptions and a set of macros to help with exceptions...
virtual SmartPtr< const Matrix > Pd_L() const
Permutation matrix (d_L_ -> d)
bool grad_f_constant_
Flag indicating if we need to ask for objective Gradient only once.
This class collects all timing statistics for Ipopt.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:164
This class stores a list of user set options.
virtual SmartPtr< const Vector > orig_d_U() const
Original unscaled upper bounds on d.
SolverReturn
enum for the return from the optimize algorithm
Definition: IpAlgTypes.hpp:19
SmartPtr< const Vector > x_L_
Lower bounds on x.
virtual SmartPtr< const Vector > x_U() const
Scaled upper bounds on x.
SmartPtr< const Vector > d_L_
Lower bounds on d.
SmartPtr< NLP > nlp_
Pointer to the NLP.
virtual SmartPtr< const SymMatrixSpace > HessianMatrixSpace() const
Accessor method to obtain the MatrixSpace for the Hessian matrix (or it&#39;s approximation) ...
HessianApproximationType
enumeration for the Hessian information type.
SmartPtr< const Matrix > Pd_L_
Permutation matrix (d_L_ -> d)
SmartPtr< const Journalist > jnlst_
Journalist.
SmartPtr< const Vector > d_U_
Upper bounds on d.
virtual Index h_evals() const
virtual SmartPtr< const Matrix > Px_L() const
Permutation matrix (x_L_ -> x)
HessianApproximationSpace
enumeration for the Hessian approximation space.
SmartPtr< const MatrixSpace > pd_u_space_
Class to organize all the data required by the algorithm.
Definition: IpIpoptData.hpp:97
SmartPtr< const SymMatrixSpace > h_space_
SmartPtr< NLP > nlp()
Accessor method to the underlying NLP.
virtual Index d_evals() const
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17
virtual SmartPtr< const Matrix > Px_U() const
Permutation matrix (x_U_ -> x)
SmartPtr< const VectorSpace > d_space_
CachedResults< SmartPtr< const Matrix > > jac_c_cache_
Jacobian Matrix for equality constraints (current iteration)
SmartPtr< const Matrix > Px_U_
Permutation matrix (x_U_ -> x)
virtual Index jac_d_evals() const
virtual SmartPtr< const Vector > d_U() const
Scaled upper bounds on d.
CachedResults< SmartPtr< const Vector > > grad_f_cache_
Gradient of the objective function.
CachedResults< Number > f_cache_
Objective function.
This class maps the traditional NLP into something that is more useful for Ipopt. ...
Class responsible for all message output.
SmartPtr< const Vector > orig_d_L_
Original unmodified lower bounds on d.
bool hessian_constant_
Flag indicating if we need to ask for Hessian only once.
SmartPtr< const Vector > orig_x_L_
Original unmodified lower bounds on x.
virtual Index grad_f_evals() const
virtual Index jac_c_evals() const
SmartPtr< const VectorSpace > d_u_space_
virtual SmartPtr< const Vector > orig_d_L() const
Original unscaled lower bounds on d.
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...
bool warm_start_same_structure_
Flag indicating whether the TNLP with identical structure has already been solved before...
CachedResults< SmartPtr< const SymMatrix > > h_cache_
Hessian of the lagrangian (current iteration)
SmartPtr< const MatrixSpace > px_l_space_
Number constr_viol_tol_
constraint violation tolerance (from OptimalityErrorConvergenceCheck)
SmartPtr< const Vector > orig_d_U_
Original unmodified upper bounds on d.
virtual SmartPtr< const Vector > orig_x_U() const
Original unscaled upper bounds on x.
virtual SmartPtr< const Matrix > Pd_U() const
Permutation matrix (d_U_ -> d)
SmartPtr< const MatrixSpace > pd_l_space_
SmartPtr< const MatrixSpace > jac_c_space_
virtual Index c_evals() const
This is the abstract base class for classes that map the traditional NLP into something that is more ...
Definition: IpIpoptNLP.hpp:35
Number bound_relax_factor_
relaxation factor for the bounds
SmartPtr< const VectorSpace > c_space_
virtual SmartPtr< const VectorSpace > x_space() const
x_space
HessianApproximationSpace hessian_approximation_space_
Flag indicating in which space Hessian is to be approximated.
SmartPtr< const Vector > x_U_
Upper bounds on x.
SmartPtr< const Matrix > Pd_U_
Permutation matrix (d_U_ -> d)