- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/coin/SVN-release/Ipopt-3.5.1/Ipopt/src/Algorithm/IpNLPScaling.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2004, 2007 International Business Machines and others.
    00002 // All Rights Reserved.
    00003 // This code is published under the Common Public License.
    00004 //
    00005 // $Id: IpNLPScaling.hpp 984 2007-05-30 23:03:22Z andreasw $
    00006 //
    00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
    00008
    00009 #ifndef __IPNLPSCALING_HPP__
    00010 #define __IPNLPSCALING_HPP__
    00011
    00012 #include "IpSymMatrix.hpp"
    00013 #include "IpScaledMatrix.hpp"
    00014 #include "IpSymScaledMatrix.hpp"
    00015 #include "IpOptionsList.hpp"
    00016 #include "IpRegOptions.hpp"
    00017
    00018 namespace Ipopt
    00019 {
    00025   class NLPScalingObject : public ReferencedObject
    00026   {
    00027   public:
    00030     NLPScalingObject()
    00031     {}
    00032
    00034     virtual ~NLPScalingObject()
    00035     {}
    00037
    00039     bool Initialize(const Journalist& jnlst,
    00040                     const OptionsList& options,
    00041                     const std::string& prefix)
    00042     {
    00043       jnlst_ = &jnlst;
    00044       return InitializeImpl(options, prefix);
    00045     }
    00046
    00050     virtual Number apply_obj_scaling(const Number& f)=0;
    00052     virtual Number unapply_obj_scaling(const Number& f)=0;
    00054     virtual SmartPtr<Vector>
    00055     apply_vector_scaling_x_NonConst(const SmartPtr<const Vector>& v)=0;
    00057     virtual SmartPtr<const Vector>
    00058     apply_vector_scaling_x(const SmartPtr<const Vector>& v)=0;
    00060     virtual SmartPtr<Vector>
    00061     unapply_vector_scaling_x_NonConst(const SmartPtr<const Vector>& v)=0;
    00063     virtual SmartPtr<const Vector>
    00064     unapply_vector_scaling_x(const SmartPtr<const Vector>& v)=0;
    00066     virtual SmartPtr<const Vector>
    00067     apply_vector_scaling_c(const SmartPtr<const Vector>& v)=0;
    00069     virtual SmartPtr<const Vector>
    00070     unapply_vector_scaling_c(const SmartPtr<const Vector>& v)=0;
    00072     virtual SmartPtr<Vector>
    00073     apply_vector_scaling_c_NonConst(const SmartPtr<const Vector>& v)=0;
    00075     virtual SmartPtr<Vector>
    00076     unapply_vector_scaling_c_NonConst(const SmartPtr<const Vector>& v)=0;
    00078     virtual SmartPtr<const Vector>
    00079     apply_vector_scaling_d(const SmartPtr<const Vector>& v)=0;
    00081     virtual SmartPtr<const Vector>
    00082     unapply_vector_scaling_d(const SmartPtr<const Vector>& v)=0;
    00084     virtual SmartPtr<Vector>
    00085     apply_vector_scaling_d_NonConst(const SmartPtr<const Vector>& v)=0;
    00087     virtual SmartPtr<Vector>
    00088     unapply_vector_scaling_d_NonConst(const SmartPtr<const Vector>& v)=0;
    00093     virtual SmartPtr<const Matrix>
    00094     apply_jac_c_scaling(SmartPtr<const Matrix> matrix)=0;
    00099     virtual SmartPtr<const Matrix>
    00100     apply_jac_d_scaling(SmartPtr<const Matrix> matrix)=0;
    00105     virtual SmartPtr<const SymMatrix>
    00106     apply_hessian_scaling(SmartPtr<const SymMatrix> matrix)=0;
    00108
    00112     SmartPtr<Vector> apply_vector_scaling_x_LU_NonConst(
    00113       const Matrix& Px_LU,
    00114       const SmartPtr<const Vector>& lu,
    00115       const VectorSpace& x_space);
    00117     SmartPtr<const Vector> apply_vector_scaling_x_LU(
    00118       const Matrix& Px_LU,
    00119       const SmartPtr<const Vector>& lu,
    00120       const VectorSpace& x_space);
    00122     SmartPtr<Vector> apply_vector_scaling_d_LU_NonConst(
    00123       const Matrix& Pd_LU,
    00124       const SmartPtr<const Vector>& lu,
    00125       const VectorSpace& d_space);
    00127     SmartPtr<const Vector> apply_vector_scaling_d_LU(
    00128       const Matrix& Pd_LU,
    00129       const SmartPtr<const Vector>& lu,
    00130       const VectorSpace& d_space);
    00132     SmartPtr<Vector> unapply_vector_scaling_d_LU_NonConst(
    00133       const Matrix& Pd_LU,
    00134       const SmartPtr<const Vector>& lu,
    00135       const VectorSpace& d_space);
    00137     SmartPtr<const Vector> unapply_vector_scaling_d_LU(
    00138       const Matrix& Pd_LU,
    00139       const SmartPtr<const Vector>& lu,
    00140       const VectorSpace& d_space);
    00142
    00148     virtual SmartPtr<Vector>
    00149     apply_grad_obj_scaling_NonConst(const SmartPtr<const Vector>& v);
    00151     virtual SmartPtr<const Vector>
    00152     apply_grad_obj_scaling(const SmartPtr<const Vector>& v);
    00155     virtual SmartPtr<Vector>
    00156     unapply_grad_obj_scaling_NonConst(const SmartPtr<const Vector>& v);
    00159     virtual SmartPtr<const Vector>
    00160     unapply_grad_obj_scaling(const SmartPtr<const Vector>& v);
    00162
    00167     virtual bool have_x_scaling()=0;
    00169     virtual bool have_c_scaling()=0;
    00171     virtual bool have_d_scaling()=0;
    00173
    00177     virtual void DetermineScaling(const SmartPtr<const VectorSpace> x_space,
    00178                                   const SmartPtr<const VectorSpace> c_space,
    00179                                   const SmartPtr<const VectorSpace> d_space,
    00180                                   const SmartPtr<const MatrixSpace> jac_c_space,
    00181                                   const SmartPtr<const MatrixSpace> jac_d_space,
    00182                                   const SmartPtr<const SymMatrixSpace> h_space,
    00183                                   SmartPtr<const MatrixSpace>& new_jac_c_space,
    00184                                   SmartPtr<const MatrixSpace>& new_jac_d_space,
    00185                                   SmartPtr<const SymMatrixSpace>& new_h_space,
    00186                                   const Matrix& Px_L, const Vector& x_L,
    00187                                   const Matrix& Px_U, const Vector& x_U)=0;
    00188   protected:
    00191     virtual bool InitializeImpl(const OptionsList& options,
    00192                                 const std::string& prefix)=0;
    00193
    00195     const Journalist& Jnlst() const
    00196     {
    00197       return *jnlst_;
    00198     }
    00199   private:
    00200
    00209
    00211     NLPScalingObject(const NLPScalingObject&);
    00212
    00214     void operator=(const NLPScalingObject&);
    00216
    00217     SmartPtr<const Journalist> jnlst_;
    00218   };
    00219
    00224   class StandardScalingBase : public NLPScalingObject
    00225   {
    00226   public:
    00229     StandardScalingBase()
    00230     {}
    00231
    00233     virtual ~StandardScalingBase()
    00234     {}
    00236
    00240     virtual Number apply_obj_scaling(const Number& f);
    00242     virtual Number unapply_obj_scaling(const Number& f);
    00244     virtual SmartPtr<Vector>
    00245     apply_vector_scaling_x_NonConst(const SmartPtr<const Vector>& v);
    00247     virtual SmartPtr<const Vector>
    00248     apply_vector_scaling_x(const SmartPtr<const Vector>& v);
    00250     virtual SmartPtr<Vector>
    00251     unapply_vector_scaling_x_NonConst(const SmartPtr<const Vector>& v);
    00253     virtual SmartPtr<const Vector>
    00254     unapply_vector_scaling_x(const SmartPtr<const Vector>& v);
    00256     virtual SmartPtr<const Vector>
    00257     apply_vector_scaling_c(const SmartPtr<const Vector>& v);
    00259     virtual SmartPtr<const Vector>
    00260     unapply_vector_scaling_c(const SmartPtr<const Vector>& v);
    00262     virtual SmartPtr<Vector>
    00263     apply_vector_scaling_c_NonConst(const SmartPtr<const Vector>& v);
    00265     virtual SmartPtr<Vector>
    00266     unapply_vector_scaling_c_NonConst(const SmartPtr<const Vector>& v);
    00268     virtual SmartPtr<const Vector>
    00269     apply_vector_scaling_d(const SmartPtr<const Vector>& v);
    00271     virtual SmartPtr<const Vector>
    00272     unapply_vector_scaling_d(const SmartPtr<const Vector>& v);
    00274     virtual SmartPtr<Vector>
    00275     apply_vector_scaling_d_NonConst(const SmartPtr<const Vector>& v);
    00277     virtual SmartPtr<Vector>
    00278     unapply_vector_scaling_d_NonConst(const SmartPtr<const Vector>& v);
    00283     virtual SmartPtr<const Matrix>
    00284     apply_jac_c_scaling(SmartPtr<const Matrix> matrix);
    00289     virtual SmartPtr<const Matrix>
    00290     apply_jac_d_scaling(SmartPtr<const Matrix> matrix);
    00295     virtual SmartPtr<const SymMatrix>
    00296     apply_hessian_scaling(SmartPtr<const SymMatrix> matrix);
    00298
    00302     virtual bool have_x_scaling();
    00303     virtual bool have_c_scaling();
    00304     virtual bool have_d_scaling();
    00306
    00310     virtual void DetermineScaling(const SmartPtr<const VectorSpace> x_space,
    00311                                   const SmartPtr<const VectorSpace> c_space,
    00312                                   const SmartPtr<const VectorSpace> d_space,
    00313                                   const SmartPtr<const MatrixSpace> jac_c_space,
    00314                                   const SmartPtr<const MatrixSpace> jac_d_space,
    00315                                   const SmartPtr<const SymMatrixSpace> h_space,
    00316                                   SmartPtr<const MatrixSpace>& new_jac_c_space,
    00317                                   SmartPtr<const MatrixSpace>& new_jac_d_space,
    00318                                   SmartPtr<const SymMatrixSpace>& new_h_space,
    00319                                   const Matrix& Px_L, const Vector& x_L,
    00320                                   const Matrix& Px_U, const Vector& x_U);
    00321
    00324     static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
    00326
    00327   protected:
    00329     virtual bool InitializeImpl(const OptionsList& options,
    00330                                 const std::string& prefix);
    00331
    00336     virtual void DetermineScalingParametersImpl(
    00337       const SmartPtr<const VectorSpace> x_space,
    00338       const SmartPtr<const VectorSpace> c_space,
    00339       const SmartPtr<const VectorSpace> d_space,
    00340       const SmartPtr<const MatrixSpace> jac_c_space,
    00341       const SmartPtr<const MatrixSpace> jac_d_space,
    00342       const SmartPtr<const SymMatrixSpace> h_space,
    00343       const Matrix& Px_L, const Vector& x_L,
    00344       const Matrix& Px_U, const Vector& x_U,
    00345       Number& df,
    00346       SmartPtr<Vector>& dx,
    00347       SmartPtr<Vector>& dc,
    00348       SmartPtr<Vector>& dd)=0;
    00349
    00350   private:
    00351
    00360
    00362     StandardScalingBase(const StandardScalingBase&);
    00363
    00365     void operator=(const StandardScalingBase&);
    00367
    00374     Number df_;
    00376     SmartPtr<Vector> dx_;
    00378
    00382     SmartPtr<ScaledMatrixSpace> scaled_jac_c_space_;
    00384     SmartPtr<ScaledMatrixSpace> scaled_jac_d_space_;
    00386     SmartPtr<SymScaledMatrixSpace> scaled_h_space_;
    00388
    00392     Number obj_scaling_factor_;
    00394   };
    00395
    00397   class NoNLPScalingObject : public StandardScalingBase
    00398   {
    00399   public:
    00402     NoNLPScalingObject()
    00403     {}
    00404
    00406     virtual ~NoNLPScalingObject()
    00407     {}
    00409
    00410
    00411   protected:
    00413     virtual void DetermineScalingParametersImpl(
    00414       const SmartPtr<const VectorSpace> x_space,
    00415       const SmartPtr<const VectorSpace> c_space,
    00416       const SmartPtr<const VectorSpace> d_space,
    00417       const SmartPtr<const MatrixSpace> jac_c_space,
    00418       const SmartPtr<const MatrixSpace> jac_d_space,
    00419       const SmartPtr<const SymMatrixSpace> h_space,
    00420       const Matrix& Px_L, const Vector& x_L,
    00421       const Matrix& Px_U, const Vector& x_U,
    00422       Number& df,
    00423       SmartPtr<Vector>& dx,
    00424       SmartPtr<Vector>& dc,
    00425       SmartPtr<Vector>& dd);
    00426
    00427   private:
    00428
    00437
    00439     NoNLPScalingObject(const NoNLPScalingObject&);
    00440
    00442     void operator=(const NoNLPScalingObject&);
    00444   };
    00445
    00446 } // namespace Ipopt
    00447
    00448 #endif