Ipopt Documentation  
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 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
6 
7 #ifndef __IPNLPSCALING_HPP__
8 #define __IPNLPSCALING_HPP__
9 
10 #include "IpOptionsList.hpp"
11 #include "IpRegOptions.hpp"
12 
13 namespace Ipopt
14 {
15 // forward declarations
16 class Vector;
17 class VectorSpace;
18 class Matrix;
19 class MatrixSpace;
20 class SymMatrix;
21 class SymMatrixSpace;
22 class ScaledMatrixSpace;
23 class SymScaledMatrixSpace;
24 
32 {
33 public:
37 
39  virtual ~NLPScalingObject();
41 
43  bool Initialize(
44  const Journalist& jnlst,
45  const OptionsList& options,
46  const std::string& prefix
47  )
48  {
49  jnlst_ = &jnlst;
50  return InitializeImpl(options, prefix);
51  }
52 
57  const Number& f
58  ) = 0;
59 
62  const Number& f
63  ) = 0;
64 
66  virtual SmartPtr<Vector>
68  const SmartPtr<const Vector>& v
69  ) = 0;
70 
74  const SmartPtr<const Vector>& v
75  ) = 0;
76 
78  virtual SmartPtr<Vector>
80  const SmartPtr<const Vector>& v
81  ) = 0;
82 
86  const SmartPtr<const Vector>& v
87  ) = 0;
88 
92  const SmartPtr<const Vector>& v
93  ) = 0;
94 
98  const SmartPtr<const Vector>& v
99  ) = 0;
100 
102  virtual SmartPtr<Vector>
104  const SmartPtr<const Vector>& v
105  ) = 0;
106 
108  virtual SmartPtr<Vector>
110  const SmartPtr<const Vector>& v
111  ) = 0;
112 
114  virtual SmartPtr<const Vector>
116  const SmartPtr<const Vector>& v
117  ) = 0;
118 
120  virtual SmartPtr<const Vector>
122  const SmartPtr<const Vector>& v
123  ) = 0;
124 
126  virtual SmartPtr<Vector>
128  const SmartPtr<const Vector>& v
129  ) = 0;
130 
132  virtual SmartPtr<Vector>
134  const SmartPtr<const Vector>& v
135  ) = 0;
136 
142  virtual SmartPtr<const Matrix>
145  ) = 0;
146 
152  virtual SmartPtr<const Matrix>
155  ) = 0;
156 
165  ) = 0;
167 
172  const Matrix& Px_LU,
173  const SmartPtr<const Vector>& lu,
174  const VectorSpace& x_space
175  );
176 
179  const Matrix& Px_LU,
180  const SmartPtr<const Vector>& lu,
181  const VectorSpace& x_space
182  );
183 
186  const Matrix& Pd_LU,
187  const SmartPtr<const Vector>& lu,
188  const VectorSpace& d_space
189  );
190 
193  const Matrix& Pd_LU,
194  const SmartPtr<const Vector>& lu,
195  const VectorSpace& d_space
196  );
197 
200  const Matrix& Pd_LU,
201  const SmartPtr<const Vector>& lu,
202  const VectorSpace& d_space
203  );
204 
207  const Matrix& Pd_LU,
208  const SmartPtr<const Vector>& lu,
209  const VectorSpace& d_space
210  );
212 
218  virtual SmartPtr<Vector>
220  const SmartPtr<const Vector>& v
221  );
222 
224  virtual SmartPtr<const Vector>
226  const SmartPtr<const Vector>& v
227  );
228 
231  virtual SmartPtr<Vector>
233  const SmartPtr<const Vector>& v
234  );
235 
238  virtual SmartPtr<const Vector>
240  const SmartPtr<const Vector>& v
241  );
243 
247  virtual bool have_x_scaling() = 0;
249  virtual bool have_c_scaling() = 0;
251  virtual bool have_d_scaling() = 0;
253 
257  virtual void DetermineScaling(
258  const SmartPtr<const VectorSpace> x_space,
259  const SmartPtr<const VectorSpace> c_space,
260  const SmartPtr<const VectorSpace> d_space,
261  const SmartPtr<const MatrixSpace> jac_c_space,
262  const SmartPtr<const MatrixSpace> jac_d_space,
263  const SmartPtr<const SymMatrixSpace> h_space,
264  SmartPtr<const MatrixSpace>& new_jac_c_space,
265  SmartPtr<const MatrixSpace>& new_jac_d_space,
266  SmartPtr<const SymMatrixSpace>& new_h_space,
267  const Matrix& Px_L,
268  const Vector& x_L,
269  const Matrix& Px_U,
270  const Vector& x_U
271  ) = 0;
272 
273 protected:
275  virtual bool InitializeImpl(
276  const OptionsList& options,
277  const std::string& prefix
278  ) = 0;
279 
281  const Journalist& Jnlst() const
282  {
283  return *jnlst_;
284  }
285 
286 private:
299  const NLPScalingObject&
300  );
301 
303  void operator=(
304  const NLPScalingObject&
305  );
307 
309 };
310 
316 {
317 public:
321 
325 
329  const Number& f
330  );
331 
333  const Number& f
334  );
335 
336  virtual SmartPtr<Vector>
338  const SmartPtr<const Vector>& v
339  );
340 
341  virtual SmartPtr<const Vector>
343  const SmartPtr<const Vector>& v
344  );
345 
346  virtual SmartPtr<Vector>
348  const SmartPtr<const Vector>& v
349  );
350 
351  virtual SmartPtr<const Vector>
353  const SmartPtr<const Vector>& v
354  );
355 
356  virtual SmartPtr<const Vector>
358  const SmartPtr<const Vector>& v
359  );
360 
361  virtual SmartPtr<const Vector>
363  const SmartPtr<const Vector>& v
364  );
365 
366  virtual SmartPtr<Vector>
368  const SmartPtr<const Vector>& v
369  );
370 
371  virtual SmartPtr<Vector>
373  const SmartPtr<const Vector>& v
374  );
375 
376  virtual SmartPtr<const Vector>
378  const SmartPtr<const Vector>& v
379  );
380 
381  virtual SmartPtr<const Vector>
383  const SmartPtr<const Vector>& v
384  );
385 
386  virtual SmartPtr<Vector>
388  const SmartPtr<const Vector>& v
389  );
390 
391  virtual SmartPtr<Vector>
393  const SmartPtr<const Vector>& v
394  );
395 
396  virtual SmartPtr<const Matrix>
399  );
400 
401  virtual SmartPtr<const Matrix>
404  );
405 
410 
413  virtual bool have_x_scaling();
414  virtual bool have_c_scaling();
415  virtual bool have_d_scaling();
417 
421  virtual void DetermineScaling(
422  const SmartPtr<const VectorSpace> x_space,
423  const SmartPtr<const VectorSpace> c_space,
424  const SmartPtr<const VectorSpace> d_space,
425  const SmartPtr<const MatrixSpace> jac_c_space,
426  const SmartPtr<const MatrixSpace> jac_d_space,
427  const SmartPtr<const SymMatrixSpace> h_space,
428  SmartPtr<const MatrixSpace>& new_jac_c_space,
429  SmartPtr<const MatrixSpace>& new_jac_d_space,
430  SmartPtr<const SymMatrixSpace>& new_h_space,
431  const Matrix& Px_L,
432  const Vector& x_L,
433  const Matrix& Px_U,
434  const Vector& x_U
435  );
436 
437  static void RegisterOptions(
439  );
440 
441 protected:
442  virtual bool InitializeImpl(
443  const OptionsList& options,
444  const std::string& prefix
445  );
446 
455  const SmartPtr<const VectorSpace> x_space,
456  const SmartPtr<const VectorSpace> c_space,
457  const SmartPtr<const VectorSpace> d_space,
458  const SmartPtr<const MatrixSpace> jac_c_space,
459  const SmartPtr<const MatrixSpace> jac_d_space,
460  const SmartPtr<const SymMatrixSpace> h_space,
461  const Matrix& Px_L,
462  const Vector& x_L,
463  const Matrix& Px_U,
464  const Vector& x_U,
465  Number& df,
466  SmartPtr<Vector>& dx,
467  SmartPtr<Vector>& dc,
468  SmartPtr<Vector>& dd
469  ) = 0;
470 
471 private:
484  const StandardScalingBase&
485  );
486 
488  void operator=(
489  const StandardScalingBase&
490  );
492 
500 
504 
509 
512 
516 
522 };
523 
526 {
527 public:
531  { }
532 
535  { }
537 
538 protected:
541  const SmartPtr<const VectorSpace> x_space,
542  const SmartPtr<const VectorSpace> c_space,
543  const SmartPtr<const VectorSpace> d_space,
544  const SmartPtr<const MatrixSpace> jac_c_space,
545  const SmartPtr<const MatrixSpace> jac_d_space,
546  const SmartPtr<const SymMatrixSpace> h_space,
547  const Matrix& Px_L,
548  const Vector& x_L,
549  const Matrix& Px_U,
550  const Vector& x_U,
551  Number& df,
552  SmartPtr<Vector>& dx,
553  SmartPtr<Vector>& dc,
554  SmartPtr<Vector>& dd
555  );
556 
557 private:
570  const NoNLPScalingObject&
571  );
572 
574  void operator=(
575  const NoNLPScalingObject&
576  );
578 };
579 
580 } // namespace Ipopt
581 
582 #endif
Class responsible for all message output.
Matrix Base Class.
Definition: IpMatrix.hpp:28
This is the abstract base class for problem scaling.
virtual SmartPtr< const Matrix > apply_jac_c_scaling(SmartPtr< const Matrix > matrix)=0
Returns a scaled version of the Jacobian for c.
virtual SmartPtr< const Vector > unapply_vector_scaling_d(const SmartPtr< const Vector > &v)=0
Returns an d-unscaled version of the given vector.
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 SymMatrix > apply_hessian_scaling(SmartPtr< const SymMatrix > matrix)=0
Returns a scaled version of the Hessian of the Lagrangian.
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.
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< Vector > apply_grad_obj_scaling_NonConst(const SmartPtr< const Vector > &v)
Methods for scaling the gradient of the objective - wraps the virtual methods above.
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< const Vector > apply_vector_scaling_x(const SmartPtr< const Vector > &v)=0
Returns an x-scaled version of the given vector.
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_vector_scaling_c(const SmartPtr< const Vector > &v)=0
Returns an c-scaled version of the given vector.
virtual SmartPtr< Vector > unapply_vector_scaling_d_NonConst(const SmartPtr< const Vector > &v)=0
Returns an d-unscaled version of the given vector.
virtual bool InitializeImpl(const OptionsList &options, const std::string &prefix)=0
Initialization method that has to be overloaded by for each derived class.
virtual SmartPtr< Vector > apply_vector_scaling_c_NonConst(const SmartPtr< const Vector > &v)=0
Returns an c-scaled version of the given vector.
virtual SmartPtr< const Vector > apply_vector_scaling_d(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.
virtual SmartPtr< const Vector > unapply_vector_scaling_c(const SmartPtr< const Vector > &v)=0
Returns an c-unscaled version of the given vector.
NLPScalingObject(const NLPScalingObject &)
Copy Constructor.
virtual Number unapply_obj_scaling(const Number &f)=0
Returns an obj-unscaled version of the given scalar.
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.
virtual ~NLPScalingObject()
Destructor.
const Journalist & Jnlst() const
Accessor method for the journalist.
virtual SmartPtr< Vector > apply_vector_scaling_x_NonConst(const SmartPtr< const Vector > &v)=0
Returns an x-scaled version of the given vector.
SmartPtr< const Journalist > jnlst_
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's at a convenient time to compute and/or read scaling factors.
virtual bool have_x_scaling()=0
Returns true if the primal x variables are scaled.
virtual SmartPtr< Vector > apply_vector_scaling_d_NonConst(const SmartPtr< const Vector > &v)=0
Returns an d-scaled version of the given vector.
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.
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 SmartPtr< const Matrix > apply_jac_d_scaling(SmartPtr< const Matrix > matrix)=0
Returns a scaled version of the Jacobian for d.
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 > 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_grad_obj_scaling(const SmartPtr< const Vector > &v)
Returns a grad_f scaled version (d_f * D_x^{-1}) of the given vector.
virtual bool have_c_scaling()=0
Returns true if the equality constraints are scaled.
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.
void operator=(const NLPScalingObject &)
Default Assignment Operator.
bool Initialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
Method to initialize the options.
Class implementing the scaling object that doesn't to any scaling.
void operator=(const NoNLPScalingObject &)
Default Assignment Operator.
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 ~NoNLPScalingObject()
Destructor.
NoNLPScalingObject(const NoNLPScalingObject &)
Copy Constructor.
This class stores a list of user set options.
Storing the reference count of all the smart pointers that currently reference it.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
This is a base class for many standard scaling techniques.
virtual SmartPtr< const Vector > unapply_vector_scaling_x(const SmartPtr< const Vector > &v)
Returns an x-unscaled version of the given vector.
virtual Number unapply_obj_scaling(const Number &f)
Returns an obj-unscaled version of the given scalar.
StandardScalingBase(const StandardScalingBase &)
Copy Constructor.
virtual SmartPtr< Vector > unapply_vector_scaling_c_NonConst(const SmartPtr< const Vector > &v)
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 bool InitializeImpl(const OptionsList &options, const std::string &prefix)
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)
Returns an d-unscaled version of the given vector.
SmartPtr< ScaledMatrixSpace > scaled_jac_d_space_
Scaled Jacobian of d space.
virtual SmartPtr< const Vector > apply_vector_scaling_x(const SmartPtr< const Vector > &v)
Returns an x-scaled version of the given vector.
SmartPtr< ScaledMatrixSpace > scaled_jac_c_space_
Scaled Matrix Spaces.
virtual ~StandardScalingBase()
Destructor.
virtual SmartPtr< const Vector > unapply_vector_scaling_c(const SmartPtr< const Vector > &v)
Returns an c-unscaled 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.
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...
void operator=(const StandardScalingBase &)
Default Assignment Operator.
virtual bool have_c_scaling()
Returns true if the equality constraints are scaled.
virtual SmartPtr< Vector > apply_vector_scaling_d_NonConst(const SmartPtr< const Vector > &v)
Returns an d-scaled 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's at a convenient time to compute and/or read scaling factors.
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
virtual bool have_x_scaling()
Returns true if the primal x variables are scaled.
virtual SmartPtr< const Matrix > apply_jac_c_scaling(SmartPtr< const Matrix > matrix)
Returns a scaled version of the Jacobian for c.
SmartPtr< Vector > dx_
x scaling
SmartPtr< SymScaledMatrixSpace > scaled_h_space_
Scaled Hessian of Lagrangian spacea.
virtual SmartPtr< Vector > unapply_vector_scaling_d_NonConst(const SmartPtr< const Vector > &v)
Returns an d-unscaled version of the given vector.
virtual SmartPtr< Vector > apply_vector_scaling_c_NonConst(const SmartPtr< const Vector > &v)
Returns an c-scaled version of the given vector.
virtual Number apply_obj_scaling(const Number &f)
Methods to map scaled and unscaled matrices.
virtual bool have_d_scaling()
Returns true if the inequality constraints are scaled.
virtual SmartPtr< const Matrix > apply_jac_d_scaling(SmartPtr< const Matrix > matrix)
Returns a scaled version of the Jacobian for d.
Number obj_scaling_factor_
Additional scaling value for the objective function.
virtual SmartPtr< const Vector > apply_vector_scaling_c(const SmartPtr< const Vector > &v)
Returns an c-scaled version of the given vector.
virtual SmartPtr< Vector > unapply_vector_scaling_x_NonConst(const SmartPtr< const Vector > &v)
Returns an x-unscaled version of the given vector.
virtual SmartPtr< Vector > apply_vector_scaling_x_NonConst(const SmartPtr< const Vector > &v)
Returns an x-scaled version of the given vector.
Number df_
Scaling parameters - we only need to keep copies of the objective scaling and the x scaling - the oth...
VectorSpace base class, corresponding to the Vector base class.
Definition: IpVector.hpp:459
Vector Base Class.
Definition: IpVector.hpp:48
#define IPOPTLIB_EXPORT
This file contains a base class for all exceptions and a set of macros to help with exceptions.
double Number
Type of all numbers.
Definition: IpTypes.hpp:15