Ipopt  3.11.9
IpNLPBoundsRemover.hpp
Go to the documentation of this file.
1 // Copyright (C) 2008, 2010 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpNLP.hpp 949 2007-03-27 00:41:26Z andreasw $
6 //
7 // Authors: Andreas Waechter IBM 2008-08-25
8 
9 #ifndef __IPNLPBOUNDSREMOVER_HPP__
10 #define __IPNLPBOUNDSREMOVER_HPP__
11 
12 #include "IpNLP.hpp"
13 
14 namespace Ipopt
15 {
24  class NLPBoundsRemover : public NLP
25  {
26  public:
31  NLPBoundsRemover(NLP& nlp, bool allow_twosided_inequalities = false);
32 
35  {}
37 
43  virtual bool ProcessOptions(const OptionsList& options,
44  const std::string& prefix)
45  {
46  return nlp_->ProcessOptions(options, prefix);
47  }
48 
52  virtual bool GetSpaces(SmartPtr<const VectorSpace>& x_space,
55  SmartPtr<const VectorSpace>& x_l_space,
56  SmartPtr<const MatrixSpace>& px_l_space,
57  SmartPtr<const VectorSpace>& x_u_space,
58  SmartPtr<const MatrixSpace>& px_u_space,
59  SmartPtr<const VectorSpace>& d_l_space,
60  SmartPtr<const MatrixSpace>& pd_l_space,
61  SmartPtr<const VectorSpace>& d_u_space,
62  SmartPtr<const MatrixSpace>& pd_u_space,
63  SmartPtr<const MatrixSpace>& Jac_c_space,
64  SmartPtr<const MatrixSpace>& Jac_d_space,
65  SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space);
66 
68  virtual bool GetBoundsInformation(const Matrix& Px_L,
69  Vector& x_L,
70  const Matrix& Px_U,
71  Vector& x_U,
72  const Matrix& Pd_L,
73  Vector& d_L,
74  const Matrix& Pd_U,
75  Vector& d_U);
76 
81  bool need_x,
82  SmartPtr<Vector> y_c,
83  bool need_y_c,
84  SmartPtr<Vector> y_d,
85  bool need_y_d,
86  SmartPtr<Vector> z_L,
87  bool need_z_L,
88  SmartPtr<Vector> z_U,
89  bool need_z_U);
90 
94  virtual bool GetWarmStartIterate(IteratesVector& warm_start_iterate)
95  {
96  return nlp_->GetWarmStartIterate(warm_start_iterate);
97  }
99 
103  virtual bool Eval_f(const Vector& x, Number& f)
104  {
105  return nlp_->Eval_f(x, f);
106  }
107 
108  virtual bool Eval_grad_f(const Vector& x, Vector& g_f)
109  {
110  return nlp_->Eval_grad_f(x, g_f);
111  }
112 
113  virtual bool Eval_c(const Vector& x, Vector& c)
114  {
115  return nlp_->Eval_c(x, c);
116  }
117 
118  virtual bool Eval_jac_c(const Vector& x, Matrix& jac_c)
119  {
120  return nlp_->Eval_jac_c(x, jac_c);
121  }
122 
123  virtual bool Eval_d(const Vector& x, Vector& d);
124 
125  virtual bool Eval_jac_d(const Vector& x, Matrix& jac_d);
126 
127  virtual bool Eval_h(const Vector& x,
128  Number obj_factor,
129  const Vector& yc,
130  const Vector& yd,
131  SymMatrix& h);
133 
142  virtual void FinalizeSolution(SolverReturn status,
143  const Vector& x, const Vector& z_L,
144  const Vector& z_U,
145  const Vector& c, const Vector& d,
146  const Vector& y_c, const Vector& y_d,
147  Number obj_value,
148  const IpoptData* ip_data,
150 
167  Index iter, Number obj_value,
168  Number inf_pr, Number inf_du,
169  Number mu, Number d_norm,
170  Number regularization_size,
171  Number alpha_du, Number alpha_pr,
172  Index ls_trials,
173  const IpoptData* ip_data,
175  {
176  return nlp_->IntermediateCallBack(mode,iter, obj_value, inf_pr, inf_du,
177  mu, d_norm, regularization_size,
178  alpha_du, alpha_pr, ls_trials,
179  ip_data, ip_cq);
180  }
182 
187  virtual void GetScalingParameters(
188  const SmartPtr<const VectorSpace> x_space,
189  const SmartPtr<const VectorSpace> c_space,
190  const SmartPtr<const VectorSpace> d_space,
193  SmartPtr<Vector>& c_scaling,
194  SmartPtr<Vector>& d_scaling) const;
196 
210  virtual void
212  SmartPtr<Matrix>& P_approx)
213  {
214  nlp_->GetQuasiNewtonApproximationSpaces(approx_space, P_approx);
215  }
216 
219  {
220  return nlp_;
221  }
222 
223  private:
236 
240 
243 
246 
249 
252 
256  };
257 
258 } // namespace Ipopt
259 
260 #endif
Ipopt::NLPBoundsRemover::Eval_jac_c
virtual bool Eval_jac_c(const Vector &x, Matrix &jac_c)
Definition: IpNLPBoundsRemover.hpp:118
Ipopt::NLPBoundsRemover::GetBoundsInformation
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)
Method for obtaining the bounds information.
Ipopt::NLPBoundsRemover::Eval_jac_d
virtual bool Eval_jac_d(const Vector &x, Matrix &jac_d)
Ipopt::NLPBoundsRemover::Eval_h
virtual bool Eval_h(const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd, SymMatrix &h)
Ipopt::IpoptData
Class to organize all the data required by the algorithm.
Definition: IpIpoptData.hpp:84
x_U
Number Number * x_U
Upper bounds on variables.
Definition: IpStdCInterface.h:145
Ipopt::NLPBoundsRemover::FinalizeSolution
virtual 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)
This method is called at the very end of the optimization.
x_L
Number * x_L
Lower bounds on variables.
Definition: IpStdCInterface.h:137
Ipopt::NLPBoundsRemover::Eval_c
virtual bool Eval_c(const Vector &x, Vector &c)
Definition: IpNLPBoundsRemover.hpp:113
Ipopt::NLPBoundsRemover::Eval_grad_f
virtual bool Eval_grad_f(const Vector &x, Vector &g_f)
Definition: IpNLPBoundsRemover.hpp:108
Ipopt::IpoptCalculatedQuantities
Class for all IPOPT specific calculated quantities.
Definition: IpIpoptCalculatedQuantities.hpp:82
Ipopt
Definition: matlabjournal.hpp:14
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::Matrix
Matrix Base Class.
Definition: IpMatrix.hpp:28
Ipopt::NLPBoundsRemover::Eval_f
virtual bool Eval_f(const Vector &x, Number &f)
Definition: IpNLPBoundsRemover.hpp:103
Ipopt::NLPBoundsRemover::Px_l_orig_
SmartPtr< const Matrix > Px_l_orig_
Pointer to the expansion matrix for the lower x bounds.
Definition: IpNLPBoundsRemover.hpp:245
Ipopt::NLPBoundsRemover::NLPBoundsRemover
NLPBoundsRemover()
Default Constructor.
Ipopt::NLPBoundsRemover::ProcessOptions
virtual bool ProcessOptions(const OptionsList &options, const std::string &prefix)
Overload if you want the chance to process options or parameters that may be specific to the NLP.
Definition: IpNLPBoundsRemover.hpp:43
IpNLP.hpp
Ipopt::NLPBoundsRemover::d_space_orig_
SmartPtr< const VectorSpace > d_space_orig_
Pointer to the original d space.
Definition: IpNLPBoundsRemover.hpp:251
x
Number * x
Input: Starting point Output: Optimal solution.
Definition: IpStdCInterface.h:238
Ipopt::NLPBoundsRemover::allow_twosided_inequalities_
bool allow_twosided_inequalities_
Flag indicating whether twosided inequality constraints are allowed.
Definition: IpNLPBoundsRemover.hpp:255
Ipopt::NLPBoundsRemover::~NLPBoundsRemover
virtual ~NLPBoundsRemover()
Default destructor.
Definition: IpNLPBoundsRemover.hpp:34
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::NLPBoundsRemover::GetScalingParameters
virtual void GetScalingParameters(const SmartPtr< const VectorSpace > x_space, const SmartPtr< const VectorSpace > c_space, const SmartPtr< const VectorSpace > d_space, Number &obj_scaling, SmartPtr< Vector > &x_scaling, SmartPtr< Vector > &c_scaling, SmartPtr< Vector > &d_scaling) const
Routines to get the scaling parameters.
Ipopt::NLPBoundsRemover
This is an adaper for an NLP that converts variable bound constraints to inequality constraints.
Definition: IpNLPBoundsRemover.hpp:25
Ipopt::NLPBoundsRemover::nlp
SmartPtr< NLP > nlp()
Accessor method to the original NLP.
Definition: IpNLPBoundsRemover.hpp:218
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:183
Ipopt::NLPBoundsRemover::NLPBoundsRemover
NLPBoundsRemover(NLP &nlp, bool allow_twosided_inequalities=false)
The constructor is given the NLP of which the bounds are to be replaced by inequality constriants.
obj_scaling
Number obj_scaling
Definition: IpStdCInterface.h:210
Ipopt::NLP
Brief Class Description.
Definition: IpNLP.hpp:32
Ipopt::NLPBoundsRemover::GetStartingPoint
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)
Method for obtaining the starting point for all the iterates.
Ipopt::NLPBoundsRemover::Px_u_orig_
SmartPtr< const Matrix > Px_u_orig_
Pointer to the expansion matrix for the upper x bounds.
Definition: IpNLPBoundsRemover.hpp:248
Ipopt::NLPBoundsRemover::GetWarmStartIterate
virtual bool GetWarmStartIterate(IteratesVector &warm_start_iterate)
Method for obtaining an entire iterate as a warmstart point.
Definition: IpNLPBoundsRemover.hpp:94
Ipopt::NLPBoundsRemover::Eval_d
virtual bool Eval_d(const Vector &x, Vector &d)
Ipopt::NLPBoundsRemover::IntermediateCallBack
virtual 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, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq)
This method is called once per iteration, after the iteration summary output has been printed.
Definition: IpNLPBoundsRemover.hpp:166
Ipopt::NLPBoundsRemover::nlp_
SmartPtr< NLP > nlp_
Pointer to the original NLP.
Definition: IpNLPBoundsRemover.hpp:242
Ipopt::SymMatrix
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:24
Ipopt::NLPBoundsRemover::GetSpaces
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)
Method for creating the derived vector / matrix types.
Ipopt::NLPBoundsRemover::GetQuasiNewtonApproximationSpaces
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: IpNLPBoundsRemover.hpp:211
Ipopt::NLPBoundsRemover::NLPBoundsRemover
NLPBoundsRemover(const NLPBoundsRemover &)
Copy Constructor.
Ipopt::SolverReturn
SolverReturn
enum for the return from the optimize algorithm (obviously we need to add more)
Definition: IpAlgTypes.hpp:22
Ipopt::OptionsList
This class stores a list of user set options.
Definition: IpOptionsList.hpp:33
Ipopt::NLPBoundsRemover::operator=
void operator=(const NLPBoundsRemover &)
Overloaded Equals Operator.
AlgorithmMode
AlgorithmMode
enum to indicate the mode in which the algorithm is
Definition: IpReturnCodes_inc.h:43
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:48
x_scaling
Number Number * x_scaling
Definition: IpStdCInterface.h:211
Ipopt::IteratesVector
Specialized CompoundVector class specifically for the algorithm iterates.
Definition: IpIteratesVector.hpp:28