Ipopt Documentation  
IpRestoIpoptNLP.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 __IPRESTOIPOPTNLP_HPP__
8 #define __IPRESTOIPOPTNLP_HPP__
9 
10 #include "IpIpoptNLP.hpp"
11 #include "IpIpoptData.hpp"
13 #include "IpCompoundMatrix.hpp"
14 #include "IpCompoundSymMatrix.hpp"
15 #include "IpCompoundVector.hpp"
16 #include "IpIdentityMatrix.hpp"
17 #include "IpDiagMatrix.hpp"
18 #include "IpZeroMatrix.hpp"
19 #include "IpOrigIpoptNLP.hpp"
20 
21 namespace Ipopt
22 {
23 
47 class RestoIpoptNLP: public IpoptNLP
48 {
49 public:
53  IpoptNLP& orig_ip_nlp,
54  IpoptData& orig_ip_data,
55  IpoptCalculatedQuantities& orig_ip_cq
56  );
57 
61 
62  virtual bool Initialize(
63  const Journalist& jnlst,
64  const OptionsList& options,
65  const std::string& prefix
66  );
67 
69  virtual bool InitializeStructures(
71  bool init_x,
72  SmartPtr<Vector>& y_c,
73  bool init_y_c,
74  SmartPtr<Vector>& y_d,
75  bool init_y_d,
76  SmartPtr<Vector>& z_L,
77  bool init_z_L,
78  SmartPtr<Vector>& z_U,
79  bool init_z_U,
80  SmartPtr<Vector>& v_L,
81  SmartPtr<Vector>& v_U);
82 
84  virtual bool GetWarmStartIterate(
85  IteratesVector& /*warm_start_iterate*/
86  )
87  {
88  return false;
89  }
90 
92  SolverReturn /*status*/,
93  const Vector& /*x*/,
94  const Vector& /*z_L*/,
95  const Vector& /*z_U*/,
96  const Vector& /*c*/,
97  const Vector& /*d*/,
98  const Vector& /*y_c*/,
99  const Vector& /*y_d*/,
100  Number /*obj_value*/,
101  const IpoptData* /*ip_data*/,
102  IpoptCalculatedQuantities* /*ip_cq*/
103  )
104  { }
105 
108 
112  virtual bool objective_depends_on_mu() const
113  {
114  return true;
115  }
116 
118  virtual Number f(
119  const Vector& x
120  );
121 
123  virtual Number f(
124  const Vector& x,
125  Number mu
126  );
127 
130  const Vector& x
131  );
132 
135  const Vector& x,
136  Number mu
137  );
138 
141  const Vector& x
142  );
143 
146  const Vector& x
147  );
148 
152  const Vector& x
153  );
154 
157  const Vector& x
158  );
159 
162  const Vector& x,
163  Number obj_factor,
164  const Vector& yc,
165  const Vector& yd
166  );
167 
170  const Vector& x,
171  Number obj_factor,
172  const Vector& yc,
173  const Vector& yd,
174  Number mu
175  );
176 
183 
185  virtual SmartPtr<const Vector> x_L() const
186  {
187  return GetRawPtr(x_L_);
188  }
189 
191  virtual SmartPtr<const Matrix> Px_L() const
192  {
193  return GetRawPtr(Px_L_);
194  }
195 
197  virtual SmartPtr<const Vector> x_U() const
198  {
199  return GetRawPtr(x_U_);
200  }
201 
203  virtual SmartPtr<const Matrix> Px_U() const
204  {
205  return GetRawPtr(Px_U_);
206  }
207 
209  virtual SmartPtr<const Vector> d_L() const
210  {
211  return GetRawPtr(d_L_);
212  }
213 
215  virtual SmartPtr<const Matrix> Pd_L() const
216  {
217  return GetRawPtr(Pd_L_);
218  }
219 
221  virtual SmartPtr<const Vector> d_U() const
222  {
223  return GetRawPtr(d_U_);
224  }
225 
227  virtual SmartPtr<const Matrix> Pd_U() const
228  {
229  return GetRawPtr(Pd_U_);
230  }
231 
233  {
234  return GetRawPtr(h_space_);
235  }
236 
238  {
239  return GetRawPtr(x_space_);
240  }
242 
244  virtual void GetSpaces(
248  SmartPtr<const VectorSpace>& x_l_space,
249  SmartPtr<const MatrixSpace>& px_l_space,
250  SmartPtr<const VectorSpace>& x_u_space,
251  SmartPtr<const MatrixSpace>& px_u_space,
252  SmartPtr<const VectorSpace>& d_l_space,
253  SmartPtr<const MatrixSpace>& pd_l_space,
254  SmartPtr<const VectorSpace>& d_u_space,
255  SmartPtr<const MatrixSpace>& pd_u_space,
256  SmartPtr<const MatrixSpace>& Jac_c_space,
257  SmartPtr<const MatrixSpace>& Jac_d_space,
258  SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space);
259 
264  virtual void AdjustVariableBounds(
265  const Vector& new_x_L,
266  const Vector& new_x_U,
267  const Vector& new_d_L,
268  const Vector& new_d_U
269  );
270 
273  AlgorithmMode mode,
274  Index iter,
275  Number obj_value,
276  Number inf_pr,
277  Number inf_du,
278  Number mu,
279  Number d_norm,
280  Number regularization_size,
281  Number alpha_du,
282  Number alpha_pr,
283  Index ls_trials,
286  );
287 
293  {
294  return *orig_ip_nlp_;
295  }
296 
298  {
299  return *orig_ip_data_;
300  }
301 
303  {
304  return *orig_ip_cq_;
305  }
307 
311  Number Rho() const
312  {
313  return rho_;
314  }
315 
318  virtual Index f_evals() const
319  {
320  return f_evals_;
321  }
322  virtual Index grad_f_evals() const
323  {
324  return grad_f_evals_;
325  }
326  virtual Index c_evals() const
327  {
328  return c_evals_;
329  }
330  virtual Index jac_c_evals() const
331  {
332  return jac_c_evals_;
333  }
334  virtual Index d_evals() const
335  {
336  return d_evals_;
337  }
338  virtual Index jac_d_evals() const
339  {
340  return jac_d_evals_;
341  }
342  virtual Index h_evals() const
343  {
344  return h_evals_;
345  }
347 
350  Number mu
351  ) const;
352 
357  {
358  return ConstPtr(dr_x_);
359  }
360 
361  static void RegisterOptions(
363  );
364 
365 private:
368 
370 
373 
377 
381 
383 
385 
387 
389 
391 
393 
395 
397 
399 
401 
403 
405 
408 
411 
413 
416 
419 
422 
425 
428 
431 
435 
438 
440 
443 
446 
453 
457 
467 
469 
472  const RestoIpoptNLP&
473  );
474 
476  void operator=(
477  const RestoIpoptNLP&
478  );
480 
483 
488 
492 
495 
506 };
507 
508 } // namespace Ipopt
509 
510 #endif
AlgorithmMode
enum to indicate the mode in which the algorithm is
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:36
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 a IpoptNLP into one that is used for the restoration phase of Ipopt.
SmartPtr< const DiagMatrix > DR2_x_
Matrix with squared scaling factors, for h()
virtual Number f(const Vector &x, Number mu)
Objective value.
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)
User callback method.
SmartPtr< const Vector > dr2_x_
Squared scaling factors for the $x$ part of the regularization term, for grad_f.
virtual SmartPtr< const VectorSpace > x_space() const
x_space
virtual SmartPtr< const Matrix > jac_d(const Vector &x)
Jacobian Matrix for inequality constraints.
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 Rho() const
Accessor Method for obtaining the Rho penalization factor for the ell_1 norm.
virtual bool GetWarmStartIterate(IteratesVector &)
Method accessing the GetWarmStartIterate of the NLP.
virtual Index f_evals() const
SmartPtr< CompoundMatrixSpace > pd_l_space_
~RestoIpoptNLP()
Destructor.
SmartPtr< CompoundVectorSpace > d_space_
virtual Index h_evals() const
virtual SmartPtr< const SymMatrixSpace > HessianMatrixSpace() const
Accessor method to obtain the MatrixSpace for the Hessian matrix (or it's approximation)
virtual Index c_evals() const
virtual SmartPtr< const Matrix > Px_U() const
Permutation matrix (x_U_ -> x.
SmartPtr< CompoundVectorSpace > x_u_space_
virtual SmartPtr< const Vector > c(const Vector &x)
Equality constraint residual.
bool evaluate_orig_obj_at_resto_trial_
Flag indicating if evaluation of the objective should be performed for every restoration phase object...
SmartPtr< IpoptNLP > orig_ip_nlp_
Pointer to the original IpoptNLP.
Number rho_
Penalty parameter for the $l_1$ norm, given by resto_penalty_parameter.
IpoptCalculatedQuantities & OrigIpCq() const
virtual SmartPtr< const SymMatrix > uninitialized_h()
Provides a Hessian matrix from the correct matrix space with uninitialized values.
SmartPtr< const Vector > DR_x() const
Method returning the scaling factors for the 2-norm penalization term.
bool initialized_
Flag indicating if initialization method has been called.
SmartPtr< CompoundVector > d_L_
Lower bounds on d.
void FinalizeSolution(SolverReturn, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, Number, const IpoptData *, IpoptCalculatedQuantities *)
virtual SmartPtr< const Vector > x_L() const
Lower bounds on x.
RestoIpoptNLP()
Default Constructor.
void operator=(const RestoIpoptNLP &)
Default Assignment Operator.
SmartPtr< CompoundVector > x_L_
Lower bounds on x.
SmartPtr< CompoundVector > d_U_
Upper bounds on d.
virtual SmartPtr< const Vector > d_U() const
Upper bounds on d.
SmartPtr< CompoundMatrix > Px_L_
Permutation matrix (x_L_ -> x)
SmartPtr< CompoundMatrixSpace > jac_c_space_
SmartPtr< CompoundVectorSpace > x_space_
Necessary Vector/Matrix spaces.
IpoptData & OrigIpData() const
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< CompoundMatrixSpace > px_l_space_
virtual Index jac_c_evals() const
virtual SmartPtr< const Matrix > Px_L() const
Permutation matrix (x_L_ -> x)
virtual bool Initialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
Initialization method.
SmartPtr< const Vector > x_ref_
$x$ part of the reference point in the regularization term
virtual Index grad_f_evals() const
SmartPtr< const Vector > dr_x_
Scaling factors for the $x$ part of the regularization term.
virtual SmartPtr< const SymMatrix > h(const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd)
Hessian of the Lagrangian (incorrect version for restoration phase)
Number Eta(Number mu) const
Method to calculate eta, the factor for the regularization term.
HessianApproximationType hessian_approximation_
Flag indicating how Hessian information is obtained.
virtual SmartPtr< const Matrix > jac_c(const Vector &x)
Jacobian Matrix for equality constraints.
virtual bool objective_depends_on_mu() const
Accessor methods for model data.
SmartPtr< CompoundMatrix > Pd_U_
Permutation matrix (d_U_ -> d.
SmartPtr< CompoundVectorSpace > c_space_
SmartPtr< CompoundMatrix > Pd_L_
Permutation matrix (d_L_ -> d)
virtual SmartPtr< const Matrix > Pd_L() const
Permutation matrix (d_L_ -> d)
SmartPtr< CompoundVectorSpace > x_l_space_
virtual SmartPtr< const Vector > grad_f(const Vector &x)
Gradient of the objective (incorrect version for restoration phase)
virtual SmartPtr< const Vector > d_L() const
Lower bounds on d.
SmartPtr< CompoundMatrixSpace > pd_u_space_
SmartPtr< CompoundMatrixSpace > jac_d_space_
SmartPtr< CompoundVector > x_U_
Upper bounds on x.
SmartPtr< CompoundMatrixSpace > px_u_space_
virtual Index jac_d_evals() const
SmartPtr< IpoptData > orig_ip_data_
Pointer to the original IpoptData.
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
Number eta_factor_
scaling factor for eta calculation
virtual SmartPtr< const Vector > d(const Vector &x)
Inequality constraint residual (reformulated as equalities with slacks.
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.
IpoptNLP & OrigIpNLP() const
virtual SmartPtr< const SymMatrix > h(const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd, Number mu)
Hessian of the Lagrangian.
SmartPtr< CompoundMatrix > Px_U_
Permutation matrix (x_U_ -> x)
virtual SmartPtr< const Matrix > Pd_U() const
Permutation matrix (d_U_ -> d.
virtual SmartPtr< const Vector > grad_f(const Vector &x, Number mu)
Gradient of the objective.
Number eta_mu_exponent_
exponent for mu in eta calculation
SmartPtr< CompoundVectorSpace > d_l_space_
RestoIpoptNLP(const RestoIpoptNLP &)
Copy Constructor.
RestoIpoptNLP(IpoptNLP &orig_ip_nlp, IpoptData &orig_ip_data, IpoptCalculatedQuantities &orig_ip_cq)
SmartPtr< IpoptCalculatedQuantities > orig_ip_cq_
Pointer to the original IpoptCalculatedQuantities.
SmartPtr< CompoundVectorSpace > d_u_space_
SmartPtr< CompoundSymMatrixSpace > h_space_
virtual Index d_evals() const
virtual Number f(const Vector &x)
Objective value (incorrect version for restoration phase)
virtual SmartPtr< const Vector > x_U() const
Upper bounds on x.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:165
Vector Base Class.
Definition: IpVector.hpp:48
This file contains a base class for all exceptions and a set of macros to help with exceptions.
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:663
HessianApproximationType
enumeration for the Hessian information type.
U * GetRawPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:649
SolverReturn
enum for the return from the optimize algorithm
Definition: IpAlgTypes.hpp:20
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17