Ipopt  3.12.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpNLPScaling.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2007 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpNLPScaling.hpp 2269 2013-05-05 11:32:40Z stefan $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8 
9 #ifndef __IPNLPSCALING_HPP__
10 #define __IPNLPSCALING_HPP__
11 
12 #include "IpOptionsList.hpp"
13 #include "IpRegOptions.hpp"
14 
15 namespace Ipopt
16 {
17  // forward declarations
18  class Vector;
19  class VectorSpace;
20  class Matrix;
21  class MatrixSpace;
22  class SymMatrix;
23  class SymMatrixSpace;
24  class ScaledMatrixSpace;
25  class SymScaledMatrixSpace;
26 
33  {
34  public:
38 
40  virtual ~NLPScalingObject();
42 
44  bool Initialize(const Journalist& jnlst,
45  const OptionsList& options,
46  const std::string& prefix)
47  {
48  jnlst_ = &jnlst;
49  return InitializeImpl(options, prefix);
50  }
51 
55  virtual Number apply_obj_scaling(const Number& f)=0;
57  virtual Number unapply_obj_scaling(const Number& f)=0;
59  virtual SmartPtr<Vector>
65  virtual SmartPtr<Vector>
77  virtual SmartPtr<Vector>
80  virtual SmartPtr<Vector>
89  virtual SmartPtr<Vector>
92  virtual SmartPtr<Vector>
104  virtual SmartPtr<const Matrix>
113 
118  const Matrix& Px_LU,
119  const SmartPtr<const Vector>& lu,
120  const VectorSpace& x_space);
123  const Matrix& Px_LU,
124  const SmartPtr<const Vector>& lu,
125  const VectorSpace& x_space);
128  const Matrix& Pd_LU,
129  const SmartPtr<const Vector>& lu,
130  const VectorSpace& d_space);
133  const Matrix& Pd_LU,
134  const SmartPtr<const Vector>& lu,
135  const VectorSpace& d_space);
138  const Matrix& Pd_LU,
139  const SmartPtr<const Vector>& lu,
140  const VectorSpace& d_space);
143  const Matrix& Pd_LU,
144  const SmartPtr<const Vector>& lu,
145  const VectorSpace& d_space);
147 
153  virtual SmartPtr<Vector>
156  virtual SmartPtr<const Vector>
160  virtual SmartPtr<Vector>
164  virtual SmartPtr<const Vector>
167 
172  virtual bool have_x_scaling()=0;
174  virtual bool have_c_scaling()=0;
176  virtual bool have_d_scaling()=0;
178 
182  virtual void DetermineScaling(const SmartPtr<const VectorSpace> x_space,
183  const SmartPtr<const VectorSpace> c_space,
184  const SmartPtr<const VectorSpace> d_space,
185  const SmartPtr<const MatrixSpace> jac_c_space,
186  const SmartPtr<const MatrixSpace> jac_d_space,
187  const SmartPtr<const SymMatrixSpace> h_space,
188  SmartPtr<const MatrixSpace>& new_jac_c_space,
189  SmartPtr<const MatrixSpace>& new_jac_d_space,
190  SmartPtr<const SymMatrixSpace>& new_h_space,
191  const Matrix& Px_L, const Vector& x_L,
192  const Matrix& Px_U, const Vector& x_U)=0;
193  protected:
196  virtual bool InitializeImpl(const OptionsList& options,
197  const std::string& prefix)=0;
198 
200  const Journalist& Jnlst() const
201  {
202  return *jnlst_;
203  }
204  private:
205 
214 
217 
219  void operator=(const NLPScalingObject&);
221 
223  };
224 
230  {
231  public:
235 
237  virtual ~StandardScalingBase();
239 
243  virtual Number apply_obj_scaling(const Number& f);
245  virtual Number unapply_obj_scaling(const Number& f);
247  virtual SmartPtr<Vector>
250  virtual SmartPtr<const Vector>
253  virtual SmartPtr<Vector>
256  virtual SmartPtr<const Vector>
259  virtual SmartPtr<const Vector>
262  virtual SmartPtr<const Vector>
265  virtual SmartPtr<Vector>
268  virtual SmartPtr<Vector>
271  virtual SmartPtr<const Vector>
274  virtual SmartPtr<const Vector>
277  virtual SmartPtr<Vector>
280  virtual SmartPtr<Vector>
286  virtual SmartPtr<const Matrix>
292  virtual SmartPtr<const Matrix>
301 
305  virtual bool have_x_scaling();
306  virtual bool have_c_scaling();
307  virtual bool have_d_scaling();
309 
313  virtual void DetermineScaling(const SmartPtr<const VectorSpace> x_space,
314  const SmartPtr<const VectorSpace> c_space,
315  const SmartPtr<const VectorSpace> d_space,
316  const SmartPtr<const MatrixSpace> jac_c_space,
317  const SmartPtr<const MatrixSpace> jac_d_space,
318  const SmartPtr<const SymMatrixSpace> h_space,
319  SmartPtr<const MatrixSpace>& new_jac_c_space,
320  SmartPtr<const MatrixSpace>& new_jac_d_space,
321  SmartPtr<const SymMatrixSpace>& new_h_space,
322  const Matrix& Px_L, const Vector& x_L,
323  const Matrix& Px_U, const Vector& x_U);
324 
327  static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
329 
330  protected:
332  virtual bool InitializeImpl(const OptionsList& options,
333  const std::string& prefix);
334 
339  virtual void DetermineScalingParametersImpl(
340  const SmartPtr<const VectorSpace> x_space,
341  const SmartPtr<const VectorSpace> c_space,
342  const SmartPtr<const VectorSpace> d_space,
343  const SmartPtr<const MatrixSpace> jac_c_space,
344  const SmartPtr<const MatrixSpace> jac_d_space,
345  const SmartPtr<const SymMatrixSpace> h_space,
346  const Matrix& Px_L, const Vector& x_L,
347  const Matrix& Px_U, const Vector& x_U,
348  Number& df,
349  SmartPtr<Vector>& dx,
350  SmartPtr<Vector>& dc,
351  SmartPtr<Vector>& dd)=0;
352 
353  private:
354 
363 
366 
368  void operator=(const StandardScalingBase&);
370 
381 
391 
397  };
398 
401  {
402  public:
406  {}
407 
410  {}
412 
413 
414  protected:
416  virtual void DetermineScalingParametersImpl(
417  const SmartPtr<const VectorSpace> x_space,
418  const SmartPtr<const VectorSpace> c_space,
419  const SmartPtr<const VectorSpace> d_space,
420  const SmartPtr<const MatrixSpace> jac_c_space,
421  const SmartPtr<const MatrixSpace> jac_d_space,
422  const SmartPtr<const SymMatrixSpace> h_space,
423  const Matrix& Px_L, const Vector& x_L,
424  const Matrix& Px_U, const Vector& x_U,
425  Number& df,
426  SmartPtr<Vector>& dx,
427  SmartPtr<Vector>& dc,
428  SmartPtr<Vector>& dd);
429 
430  private:
431 
440 
443 
445  void operator=(const NoNLPScalingObject&);
447  };
448 
449 } // namespace Ipopt
450 
451 #endif
This is the abstract base class for problem scaling.
virtual bool InitializeImpl(const OptionsList &options, const std::string &prefix)
Overloaded initialization method.
virtual SmartPtr< const Matrix > apply_jac_c_scaling(SmartPtr< const Matrix > matrix)
Returns a scaled version of the jacobian for c.
virtual SmartPtr< Vector > apply_vector_scaling_d_NonConst(const SmartPtr< const Vector > &v)=0
Returns an d-scaled version of the given vector.
virtual bool have_d_scaling()=0
Returns true if the inequality constraints are scaled.
void operator=(const NoNLPScalingObject &)
Overloaded Equals Operator.
virtual SmartPtr< const Vector > apply_vector_scaling_c(const SmartPtr< const Vector > &v)
Returns an c-scaled version of the given vector.
virtual Number unapply_obj_scaling(const Number &f)=0
Returns an obj-unscaled version of the given scalar.
virtual SmartPtr< Vector > apply_vector_scaling_d_NonConst(const SmartPtr< const Vector > &v)
Returns an d-scaled version of the given vector.
virtual Number unapply_obj_scaling(const Number &f)
Returns an obj-unscaled version of the given scalar.
virtual SmartPtr< Vector > unapply_grad_obj_scaling_NonConst(const SmartPtr< const Vector > &v)
Returns a grad_f unscaled version (d_f * D_x^{-1}) of the given vector.
virtual bool have_c_scaling()
Returns true if the equality constraints are scaled.
virtual SmartPtr< Vector > unapply_vector_scaling_d_NonConst(const SmartPtr< const Vector > &v)=0
Returns an d-unscaled version of the given vector.
Number obj_scaling_factor_
Additional scaling value for the objective function.
virtual bool have_x_scaling()=0
Returns true if the primal x variables are scaled.
SmartPtr< const Vector > unapply_vector_scaling_d_LU(const Matrix &Pd_LU, const SmartPtr< const Vector > &lu, const VectorSpace &d_space)
Returns an d-unscaled vector in the d_L or d_U space.
virtual SmartPtr< Vector > unapply_vector_scaling_d_NonConst(const SmartPtr< const Vector > &v)
Returns an d-unscaled version of the given vector.
virtual ~StandardScalingBase()
Default destructor.
Class implementing the scaling object that doesn&#39;t to any scaling.
SmartPtr< const Vector > apply_vector_scaling_x_LU(const Matrix &Px_LU, const SmartPtr< const Vector > &lu, const VectorSpace &x_space)
Returns an x-scaled vector in the x_L or x_U space.
virtual bool have_c_scaling()=0
Returns true if the equality constraints are scaled.
SmartPtr< SymScaledMatrixSpace > scaled_h_space_
Scaled hessian of lagrangian spacea.
void operator=(const NLPScalingObject &)
Overloaded Equals Operator.
SmartPtr< ScaledMatrixSpace > scaled_jac_d_space_
Scaled jacobian of d space.
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
SmartPtr< Vector > unapply_vector_scaling_d_LU_NonConst(const Matrix &Pd_LU, const SmartPtr< const Vector > &lu, const VectorSpace &d_space)
Returns an d-unscaled vector in the d_L or d_U space.
Vector Base Class.
Definition: IpVector.hpp:47
virtual bool InitializeImpl(const OptionsList &options, const std::string &prefix)=0
Implementation of the initialization method that has to be overloaded by for each derived class...
virtual SmartPtr< const Vector > unapply_vector_scaling_d(const SmartPtr< const Vector > &v)=0
Returns an d-unscaled version of the given vector.
virtual ~NLPScalingObject()
Default destructor.
virtual SmartPtr< const Matrix > apply_jac_d_scaling(SmartPtr< const Matrix > matrix)=0
Returns a scaled version of the jacobian for d If the overloaded method does not create a new matrix...
This is a base class for many standard scaling techniques.
virtual ~NoNLPScalingObject()
Default destructor.
SmartPtr< Vector > apply_vector_scaling_x_LU_NonConst(const Matrix &Px_LU, const SmartPtr< const Vector > &lu, const VectorSpace &x_space)
Methods for scaling bounds - these wrap those above.
virtual SmartPtr< const Vector > unapply_vector_scaling_d(const SmartPtr< const Vector > &v)
Returns an d-unscaled version of the given vector.
virtual bool have_d_scaling()
Returns true if the inequality constraints are scaled.
virtual SmartPtr< Vector > apply_vector_scaling_x_NonConst(const SmartPtr< const Vector > &v)
Returns an x-scaled version of the given vector.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
virtual SmartPtr< const Vector > apply_vector_scaling_c(const SmartPtr< const Vector > &v)=0
Returns an c-scaled version of the given vector.
ReferencedObject class.
virtual SmartPtr< const Vector > apply_vector_scaling_d(const SmartPtr< const Vector > &v)=0
Returns an d-scaled version of the given vector.
SmartPtr< Vector > apply_vector_scaling_d_LU_NonConst(const Matrix &Pd_LU, const SmartPtr< const Vector > &lu, const VectorSpace &d_space)
Returns an d-scaled vector in the d_L or d_U space.
virtual Number apply_obj_scaling(const Number &f)=0
Methods to map scaled and unscaled matrices.
This class stores a list of user set options.
virtual SmartPtr< Vector > apply_vector_scaling_c_NonConst(const SmartPtr< const Vector > &v)
Returns an c-scaled version of the given vector.
VectorSpace base class, corresponding to the Vector base class.
Definition: IpVector.hpp:390
virtual SmartPtr< Vector > unapply_vector_scaling_c_NonConst(const SmartPtr< const Vector > &v)
Returns an c-unscaled version of the given vector.
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
Methods for IpoptType.
SmartPtr< const Journalist > jnlst_
Matrix Base Class.
Definition: IpMatrix.hpp:27
SmartPtr< const Vector > apply_vector_scaling_d_LU(const Matrix &Pd_LU, const SmartPtr< const Vector > &lu, const VectorSpace &d_space)
Returns an d-scaled vector in the d_L or d_U space.
virtual SmartPtr< const Vector > unapply_vector_scaling_c(const SmartPtr< const Vector > &v)=0
Returns an c-unscaled version of the given vector.
virtual SmartPtr< const SymMatrix > apply_hessian_scaling(SmartPtr< const SymMatrix > matrix)=0
Returns a scaled version of the hessian of the lagrangian If the overloaded method does not create a ...
virtual SmartPtr< const Vector > apply_vector_scaling_x(const SmartPtr< const Vector > &v)=0
Returns an x-scaled version of the given vector.
virtual SmartPtr< const SymMatrix > apply_hessian_scaling(SmartPtr< const SymMatrix > matrix)
Returns a scaled version of the hessian of the lagrangian If the overloaded method does not create a ...
const Journalist & Jnlst() const
Accessor method for the journalist.
SmartPtr< ScaledMatrixSpace > scaled_jac_c_space_
Scaled Matrix Spaces.
Number * x_L
Lower bounds on variables.
virtual void DetermineScalingParametersImpl(const SmartPtr< const VectorSpace > x_space, const SmartPtr< const VectorSpace > c_space, const SmartPtr< const VectorSpace > d_space, const SmartPtr< const MatrixSpace > jac_c_space, const SmartPtr< const MatrixSpace > jac_d_space, const SmartPtr< const SymMatrixSpace > h_space, const Matrix &Px_L, const Vector &x_L, const Matrix &Px_U, const Vector &x_U, Number &df, SmartPtr< Vector > &dx, SmartPtr< Vector > &dc, SmartPtr< Vector > &dd)
Overloaded from StandardScalingBase.
virtual void DetermineScalingParametersImpl(const SmartPtr< const VectorSpace > x_space, const SmartPtr< const VectorSpace > c_space, const SmartPtr< const VectorSpace > d_space, const SmartPtr< const MatrixSpace > jac_c_space, const SmartPtr< const MatrixSpace > jac_d_space, const SmartPtr< const SymMatrixSpace > h_space, const Matrix &Px_L, const Vector &x_L, const Matrix &Px_U, const Vector &x_U, Number &df, SmartPtr< Vector > &dx, SmartPtr< Vector > &dc, SmartPtr< Vector > &dd)=0
This is the method that has to be overloaded by a particular scaling method that somehow computes the...
Number Number * x_U
Upper bounds on variables.
virtual SmartPtr< Vector > apply_grad_obj_scaling_NonConst(const SmartPtr< const Vector > &v)
Methods for scaling the gradient of the objective - wraps the virtual methods above.
bool Initialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
Method to initialize the options.
virtual SmartPtr< const Vector > unapply_vector_scaling_x(const SmartPtr< const Vector > &v)=0
Returns an x-unscaled version of the given vector.
virtual SmartPtr< Vector > apply_vector_scaling_x_NonConst(const SmartPtr< const Vector > &v)=0
Returns an x-scaled version of the given vector.
virtual SmartPtr< const Vector > unapply_vector_scaling_c(const SmartPtr< const Vector > &v)
Returns an c-unscaled version of the given vector.
virtual Number apply_obj_scaling(const Number &f)
Methods to map scaled and unscaled matrices.
virtual SmartPtr< const Matrix > apply_jac_d_scaling(SmartPtr< const Matrix > matrix)
Returns a scaled version of the jacobian for d If the overloaded method does not create a new matrix...
Class responsible for all message output.
virtual SmartPtr< const Vector > unapply_grad_obj_scaling(const SmartPtr< const Vector > &v)
Returns a grad_f unscaled version (d_f * D_x^{-1}) of the given vector.
virtual void DetermineScaling(const SmartPtr< const VectorSpace > x_space, const SmartPtr< const VectorSpace > c_space, const SmartPtr< const VectorSpace > d_space, const SmartPtr< const MatrixSpace > jac_c_space, const SmartPtr< const MatrixSpace > jac_d_space, const SmartPtr< const SymMatrixSpace > h_space, SmartPtr< const MatrixSpace > &new_jac_c_space, SmartPtr< const MatrixSpace > &new_jac_d_space, SmartPtr< const SymMatrixSpace > &new_h_space, const Matrix &Px_L, const Vector &x_L, const Matrix &Px_U, const Vector &x_U)=0
This method is called by the IpoptNLP&#39;s at a convenient time to compute and/or read scaling factors...
void operator=(const StandardScalingBase &)
Overloaded Equals Operator.
Number df_
Scaling parameters - we only need to keep copies of the objective scaling and the x scaling - the oth...
virtual SmartPtr< Vector > unapply_vector_scaling_x_NonConst(const SmartPtr< const Vector > &v)
Returns an x-unscaled version of the given vector.
virtual void DetermineScaling(const SmartPtr< const VectorSpace > x_space, const SmartPtr< const VectorSpace > c_space, const SmartPtr< const VectorSpace > d_space, const SmartPtr< const MatrixSpace > jac_c_space, const SmartPtr< const MatrixSpace > jac_d_space, const SmartPtr< const SymMatrixSpace > h_space, SmartPtr< const MatrixSpace > &new_jac_c_space, SmartPtr< const MatrixSpace > &new_jac_d_space, SmartPtr< const SymMatrixSpace > &new_h_space, const Matrix &Px_L, const Vector &x_L, const Matrix &Px_U, const Vector &x_U)
This method is called by the IpoptNLP&#39;s at a convenient time to compute and/or read scaling factors...
virtual SmartPtr< Vector > unapply_vector_scaling_x_NonConst(const SmartPtr< const Vector > &v)=0
Returns an x-unscaled version of the given vector.
virtual SmartPtr< const Vector > apply_grad_obj_scaling(const SmartPtr< const Vector > &v)
Returns a grad_f scaled version (d_f * D_x^{-1}) of the given vector.
virtual SmartPtr< const Vector > unapply_vector_scaling_x(const SmartPtr< const Vector > &v)
Returns an x-unscaled version of the given vector.
virtual SmartPtr< const Matrix > apply_jac_c_scaling(SmartPtr< const Matrix > matrix)=0
Returns a scaled version of the jacobian for c.
virtual SmartPtr< Vector > unapply_vector_scaling_c_NonConst(const SmartPtr< const Vector > &v)=0
Returns an c-unscaled version of the given vector.
virtual SmartPtr< const Vector > apply_vector_scaling_d(const SmartPtr< const Vector > &v)
Returns an d-scaled version of the given vector.
virtual SmartPtr< Vector > apply_vector_scaling_c_NonConst(const SmartPtr< const Vector > &v)=0
Returns an c-scaled version of the given vector.
virtual bool have_x_scaling()
Returns true if the primal x variables are scaled.
virtual SmartPtr< const Vector > apply_vector_scaling_x(const SmartPtr< const Vector > &v)
Returns an x-scaled version of the given vector.
SmartPtr< Vector > dx_
x scaling