Ipopt  3.12.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 // $Id: IpRestoIpoptNLP.hpp 2594 2015-08-09 14:31:05Z stefan $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8 
9 #ifndef __IPRESTOIPOPTNLP_HPP__
10 #define __IPRESTOIPOPTNLP_HPP__
11 
12 #include "IpIpoptNLP.hpp"
13 #include "IpIpoptData.hpp"
15 #include "IpCompoundMatrix.hpp"
16 #include "IpCompoundSymMatrix.hpp"
17 #include "IpCompoundVector.hpp"
18 #include "IpIdentityMatrix.hpp"
19 #include "IpDiagMatrix.hpp"
20 #include "IpZeroMatrix.hpp"
21 #include "IpOrigIpoptNLP.hpp"
22 
23 namespace Ipopt
24 {
25 
32  class RestoIpoptNLP : public IpoptNLP
33  {
34  public:
37  RestoIpoptNLP(IpoptNLP& orig_ip_nlp,
38  IpoptData& orig_ip_data,
39  IpoptCalculatedQuantities& orig_ip_cq);
40 
44 
46  virtual bool Initialize(const Journalist& jnlst,
47  const OptionsList& options,
48  const std::string& prefix);
49 
53  bool init_x,
54  SmartPtr<Vector>& y_c,
55  bool init_y_c,
56  SmartPtr<Vector>& y_d,
57  bool init_y_d,
58  SmartPtr<Vector>& z_L,
59  bool init_z_L,
60  SmartPtr<Vector>& z_U,
61  bool init_z_U,
62  SmartPtr<Vector>& v_L,
63  SmartPtr<Vector>& v_U
64  );
65 
67  virtual bool GetWarmStartIterate(IteratesVector& warm_start_iterate)
68  {
69  return false;
70  }
71 
75  const Vector& x, const Vector& z_L, const Vector& z_U,
76  const Vector& c, const Vector& d,
77  const Vector& y_c, const Vector& y_d,
78  Number obj_value,
79  const IpoptData* ip_data,
81  {}
83 
89  virtual bool objective_depends_on_mu() const
90  {
91  return true;
92  }
93 
95  virtual Number f(const Vector& x);
96 
98  virtual Number f(const Vector& x, Number mu);
99 
101  virtual SmartPtr<const Vector> grad_f(const Vector& x);
102 
104  virtual SmartPtr<const Vector> grad_f(const Vector& x, Number mu);
105 
107  virtual SmartPtr<const Vector> c(const Vector& x);
108 
110  virtual SmartPtr<const Matrix> jac_c(const Vector& x);
111 
114  virtual SmartPtr<const Vector> d(const Vector& x);
115 
117  virtual SmartPtr<const Matrix> jac_d(const Vector& x);
118 
121  virtual SmartPtr<const SymMatrix> h(const Vector& x,
122  Number obj_factor,
123  const Vector& yc,
124  const Vector& yd
125  );
126 
128  virtual SmartPtr<const SymMatrix> h(const Vector& x,
129  Number obj_factor,
130  const Vector& yc,
131  const Vector& yd,
132  Number mu);
133 
138 
140  virtual SmartPtr<const Vector> x_L() const
141  {
142  return GetRawPtr(x_L_);
143  }
144 
146  virtual SmartPtr<const Matrix> Px_L() const
147  {
148  return GetRawPtr(Px_L_);
149  }
150 
152  virtual SmartPtr<const Vector> x_U() const
153  {
154  return GetRawPtr(x_U_);
155  }
156 
158  virtual SmartPtr<const Matrix> Px_U() const
159  {
160  return GetRawPtr(Px_U_);
161  }
162 
164  virtual SmartPtr<const Vector> d_L() const
165  {
166  return GetRawPtr(d_L_);
167  }
168 
170  virtual SmartPtr<const Matrix> Pd_L() const
171  {
172  return GetRawPtr(Pd_L_);
173  }
174 
176  virtual SmartPtr<const Vector> d_U() const
177  {
178  return GetRawPtr(d_U_);
179  }
180 
182  virtual SmartPtr<const Matrix> Pd_U() const
183  {
184  return GetRawPtr(Pd_U_);
185  }
186 
188  {
189  return GetRawPtr(h_space_);
190  }
191 
193  {
194  return GetRawPtr(x_space_);
195  }
197 
202  SmartPtr<const VectorSpace>& x_l_space,
203  SmartPtr<const MatrixSpace>& px_l_space,
204  SmartPtr<const VectorSpace>& x_u_space,
205  SmartPtr<const MatrixSpace>& px_u_space,
206  SmartPtr<const VectorSpace>& d_l_space,
207  SmartPtr<const MatrixSpace>& pd_l_space,
208  SmartPtr<const VectorSpace>& d_u_space,
209  SmartPtr<const MatrixSpace>& pd_u_space,
210  SmartPtr<const MatrixSpace>& Jac_c_space,
211  SmartPtr<const MatrixSpace>& Jac_d_space,
212  SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space);
215  virtual void AdjustVariableBounds(const Vector& new_x_L,
216  const Vector& new_x_U,
217  const Vector& new_d_L,
218  const Vector& new_d_U);
219 
222  Index iter, Number obj_value,
223  Number inf_pr, Number inf_du,
224  Number mu, Number d_norm,
225  Number regularization_size,
226  Number alpha_du, Number alpha_pr,
227  Index ls_trials,
230 
235  {
236  return *orig_ip_nlp_;
237  }
239  {
240  return *orig_ip_data_;
241  }
243  {
244  return *orig_ip_cq_;
245  }
247 
250  Number Rho() const
251  {
252  return rho_;
253  }
254 
257  virtual Index f_evals() const
258  {
259  return f_evals_;
260  }
261  virtual Index grad_f_evals() const
262  {
263  return grad_f_evals_;
264  }
265  virtual Index c_evals() const
266  {
267  return c_evals_;
268  }
269  virtual Index jac_c_evals() const
270  {
271  return jac_c_evals_;
272  }
273  virtual Index d_evals() const
274  {
275  return d_evals_;
276  }
277  virtual Index jac_d_evals() const
278  {
279  return jac_d_evals_;
280  }
281  virtual Index h_evals() const
282  {
283  return h_evals_;
284  }
286 
288  Number Eta(Number mu) const;
289 
293  {
294  return ConstPtr(dr_x_);
295  }
296 
300  static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
302 
303  private:
308 
311 
315 
319 
321 
323 
325 
327 
329 
331 
333 
335 
337 
339 
341 
343 
346 
351 
354 
357 
360 
363 
366 
369 
373 
377  /* ToDo make this parameter? */
383  // TODO in the following we should use pointers to CONST values
386  SmartPtr<DiagMatrix> DR_x_; //TODO We can get rid of one of the dr DR
390 
400  RestoIpoptNLP();
401 
404 
406  void operator=(const RestoIpoptNLP&);
408 
418 
421 
432  };
433 
434 } // namespace Ipopt
435 
436 #endif
virtual bool GetWarmStartIterate(IteratesVector &warm_start_iterate)
Method accessing the GetWarmStartIterate of the NLP.
SmartPtr< CompoundMatrixSpace > pd_l_space_
Number * x
Input: Starting point Output: Optimal solution.
virtual SmartPtr< const Vector > d_U() const
Upper bounds on d.
void operator=(const RestoIpoptNLP &)
Overloaded Equals Operator.
SmartPtr< CompoundVectorSpace > x_l_space_
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.
Specialized CompoundVector class specifically for the algorithm iterates.
Class for all IPOPT specific calculated quantities.
SmartPtr< CompoundVector > x_U_
Upper bounds on x.
SmartPtr< CompoundVectorSpace > c_space_
SmartPtr< CompoundMatrix > Px_U_
Permutation matrix (x_U_ -&gt; x)
bool evaluate_orig_obj_at_resto_trial_
Flag indicating if evalution of the objective should be performed for every restoration phase objecti...
SmartPtr< CompoundVectorSpace > d_u_space_
SmartPtr< CompoundVectorSpace > d_space_
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.
virtual Index h_evals() const
virtual Index d_evals() const
virtual SmartPtr< const Vector > d(const Vector &x)
Inequality constraint residual (reformulated as equalities with slacks.
virtual SmartPtr< const Matrix > Pd_L() const
Permutation matrix (d_L_ -&gt; d)
SmartPtr< CompoundMatrixSpace > px_l_space_
virtual Index c_evals() const
virtual SmartPtr< const Vector > d_L() const
Lower bounds on d.
~RestoIpoptNLP()
Default destructor.
virtual SmartPtr< const Matrix > Px_L() const
Permutation matrix (x_L_ -&gt; x)
SmartPtr< CompoundVector > x_L_
Lower bounds on x.
AlgorithmMode
enum to indicate the mode in which the algorithm is
SmartPtr< IpoptData > orig_ip_data_
Pointer to the original IpoptData.
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Vector Base Class.
Definition: IpVector.hpp:47
SmartPtr< DiagMatrix > DR_x_
Number eta_factor_
scaling factor for eta calculation
SmartPtr< CompoundMatrix > Pd_U_
Permutation matrix (d_U_ -&gt; d.
IpoptData & OrigIpData() const
Number eta_mu_exponent_
exponent for mu in eta calculation
SmartPtr< CompoundMatrix > Pd_L_
Permutation matrix (d_L_ -&gt; d)
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< CompoundSymMatrixSpace > h_space_
virtual Index jac_d_evals() const
virtual bool objective_depends_on_mu() const
Accessor methods for model data.
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.
Number Eta(Number mu) const
Method to calculate eta, the factor for the regularization term.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Number rho_
Penalty parameter for the $l_1$ norm.
SmartPtr< CompoundVectorSpace > x_u_space_
This class stores a list of user set options.
SolverReturn
enum for the return from the optimize algorithm (obviously we need to add more)
Definition: IpAlgTypes.hpp:22
virtual SmartPtr< const Matrix > Px_U() const
Permutation matrix (x_U_ -&gt; x.
U * GetRawPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:560
HessianApproximationType hessian_approximation_
Flag indicating how hessian information is obtained.
SmartPtr< CompoundMatrixSpace > jac_c_space_
HessianApproximationType
enumeration for the Hessian information type.
virtual Index grad_f_evals() const
SmartPtr< CompoundVector > d_U_
Upper bounds on d.
SmartPtr< const Vector > DR_x() const
Method returning the scaling factors for the 2-norm penalization term.
virtual SmartPtr< const Vector > x_L() const
Lower bounds on x.
virtual SmartPtr< const SymMatrixSpace > HessianMatrixSpace() const
Accessor method to obtain the MatrixSpace for the Hessian matrix (or it&#39;s approximation) ...
SmartPtr< Vector > x_ref_
$x$ part of the reference point in the regularization term
Class to organize all the data required by the algorithm.
Definition: IpIpoptData.hpp:83
This class maps the traditional NLP into something that is more useful by Ipopt.
Number Rho() const
Accessor Method for obtaining the Rho penalization factor for the ell_1 norm.
SmartPtr< IpoptNLP > orig_ip_nlp_
Pointer to the original IpoptNLP.
bool initialized_
Flag indicating if initialization method has been called.
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
Methods for IpoptType.
virtual SmartPtr< const Matrix > Pd_U() const
Permutation matrix (d_U_ -&gt; d.
IpoptNLP & OrigIpNLP() const
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
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.
SmartPtr< IpoptCalculatedQuantities > orig_ip_cq_
Pointer to the original IpoptCalculatedQuantities.
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:572
virtual SmartPtr< const VectorSpace > x_space() const
x_space
SmartPtr< CompoundVectorSpace > d_l_space_
Class responsible for all message output.
virtual Index f_evals() const
virtual Index jac_c_evals() const
virtual bool Initialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
Initialize - overloaded from IpoptNLP.
SmartPtr< CompoundMatrixSpace > px_u_space_
virtual SmartPtr< const SymMatrix > uninitialized_h()
Provides a Hessian matrix from the correct matrix space with uninitialized values.
virtual SmartPtr< const Matrix > jac_c(const Vector &x)
Jacobian Matrix for equality constraints.
SmartPtr< Vector > dr_x_
Scaling factors for the $x$ part of the regularization term.
This is the abstract base class for classes that map the traditional NLP into something that is more ...
Definition: IpIpoptNLP.hpp:28
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)
IpoptCalculatedQuantities & OrigIpCq() const
virtual Number f(const Vector &x)
Objective value (incorrect version for restoration phase)
SmartPtr< CompoundMatrixSpace > jac_d_space_
virtual SmartPtr< const Vector > grad_f(const Vector &x)
Gradient of the objective (incorrect version for restoration phase)
virtual SmartPtr< const Vector > c(const Vector &x)
Equality constraint residual.
RestoIpoptNLP()
Default Constructor.
SmartPtr< CompoundVectorSpace > x_space_
Necessary Vector/Matrix spaces.
virtual SmartPtr< const Matrix > jac_d(const Vector &x)
Jacobian Matrix for inequality constraints.
virtual SmartPtr< const Vector > x_U() const
Upper bounds on x.
SmartPtr< CompoundMatrix > Px_L_
Permutation matrix (x_L_ -&gt; x)
SmartPtr< CompoundVector > d_L_
Lower bounds on d.
SmartPtr< CompoundMatrixSpace > pd_u_space_