- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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

Go to the documentation of this file.

    00001 // Copyright (C) 2004, 2006 International Business Machines and others.
    00002 // All Rights Reserved.
    00003 // This code is published under the Common Public License.
    00004 //
    00005 // $Id: IpNLPScaling.hpp 759 2006-07-07 03:07:08Z 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)=0;
    00186   protected:
    00189     virtual bool InitializeImpl(const OptionsList& options,
    00190                                 const std::string& prefix)=0;
    00191
    00193     const Journalist& Jnlst() const
    00194     {
    00195       return *jnlst_;
    00196     }
    00197   private:
    00198
    00207
    00209     NLPScalingObject(const NLPScalingObject&);
    00210
    00212     void operator=(const NLPScalingObject&);
    00214
    00215     SmartPtr<const Journalist> jnlst_;
    00216   };
    00217
    00222   class StandardScalingBase : public NLPScalingObject
    00223   {
    00224   public:
    00227     StandardScalingBase()
    00228     {}
    00229
    00231     virtual ~StandardScalingBase()
    00232     {}
    00234
    00238     virtual Number apply_obj_scaling(const Number& f);
    00240     virtual Number unapply_obj_scaling(const Number& f);
    00242     virtual SmartPtr<Vector>
    00243     apply_vector_scaling_x_NonConst(const SmartPtr<const Vector>& v);
    00245     virtual SmartPtr<const Vector>
    00246     apply_vector_scaling_x(const SmartPtr<const Vector>& v);
    00248     virtual SmartPtr<Vector>
    00249     unapply_vector_scaling_x_NonConst(const SmartPtr<const Vector>& v);
    00251     virtual SmartPtr<const Vector>
    00252     unapply_vector_scaling_x(const SmartPtr<const Vector>& v);
    00254     virtual SmartPtr<const Vector>
    00255     apply_vector_scaling_c(const SmartPtr<const Vector>& v);
    00257     virtual SmartPtr<const Vector>
    00258     unapply_vector_scaling_c(const SmartPtr<const Vector>& v);
    00260     virtual SmartPtr<Vector>
    00261     apply_vector_scaling_c_NonConst(const SmartPtr<const Vector>& v);
    00263     virtual SmartPtr<Vector>
    00264     unapply_vector_scaling_c_NonConst(const SmartPtr<const Vector>& v);
    00266     virtual SmartPtr<const Vector>
    00267     apply_vector_scaling_d(const SmartPtr<const Vector>& v);
    00269     virtual SmartPtr<const Vector>
    00270     unapply_vector_scaling_d(const SmartPtr<const Vector>& v);
    00272     virtual SmartPtr<Vector>
    00273     apply_vector_scaling_d_NonConst(const SmartPtr<const Vector>& v);
    00275     virtual SmartPtr<Vector>
    00276     unapply_vector_scaling_d_NonConst(const SmartPtr<const Vector>& v);
    00281     virtual SmartPtr<const Matrix>
    00282     apply_jac_c_scaling(SmartPtr<const Matrix> matrix);
    00287     virtual SmartPtr<const Matrix>
    00288     apply_jac_d_scaling(SmartPtr<const Matrix> matrix);
    00293     virtual SmartPtr<const SymMatrix>
    00294     apply_hessian_scaling(SmartPtr<const SymMatrix> matrix);
    00296
    00300     virtual bool have_x_scaling();
    00301     virtual bool have_c_scaling();
    00302     virtual bool have_d_scaling();
    00304
    00308     virtual void DetermineScaling(const SmartPtr<const VectorSpace> x_space,
    00309                                   const SmartPtr<const VectorSpace> c_space,
    00310                                   const SmartPtr<const VectorSpace> d_space,
    00311                                   const SmartPtr<const MatrixSpace> jac_c_space,
    00312                                   const SmartPtr<const MatrixSpace> jac_d_space,
    00313                                   const SmartPtr<const SymMatrixSpace> h_space,
    00314                                   SmartPtr<const MatrixSpace>& new_jac_c_space,
    00315                                   SmartPtr<const MatrixSpace>& new_jac_d_space,
    00316                                   SmartPtr<const SymMatrixSpace>& new_h_space);
    00317
    00320     static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
    00322
    00323   protected:
    00325     virtual bool InitializeImpl(const OptionsList& options,
    00326                                 const std::string& prefix);
    00327
    00332     virtual void DetermineScalingParametersImpl(
    00333       const SmartPtr<const VectorSpace> x_space,
    00334       const SmartPtr<const VectorSpace> c_space,
    00335       const SmartPtr<const VectorSpace> d_space,
    00336       const SmartPtr<const MatrixSpace> jac_c_space,
    00337       const SmartPtr<const MatrixSpace> jac_d_space,
    00338       const SmartPtr<const SymMatrixSpace> h_space,
    00339       Number& df,
    00340       SmartPtr<Vector>& dx,
    00341       SmartPtr<Vector>& dc,
    00342       SmartPtr<Vector>& dd)=0;
    00343
    00344   private:
    00345
    00354
    00356     StandardScalingBase(const StandardScalingBase&);
    00357
    00359     void operator=(const StandardScalingBase&);
    00361
    00368     Number df_;
    00370     SmartPtr<Vector> dx_;
    00372
    00376     SmartPtr<ScaledMatrixSpace> scaled_jac_c_space_;
    00378     SmartPtr<ScaledMatrixSpace> scaled_jac_d_space_;
    00380     SmartPtr<SymScaledMatrixSpace> scaled_h_space_;
    00382
    00386     Number obj_scaling_factor_;
    00388   };
    00389
    00391   class NoNLPScalingObject : public StandardScalingBase
    00392   {
    00393   public:
    00396     NoNLPScalingObject()
    00397     {}
    00398
    00400     virtual ~NoNLPScalingObject()
    00401     {}
    00403
    00404
    00405   protected:
    00407     virtual void DetermineScalingParametersImpl(
    00408       const SmartPtr<const VectorSpace> x_space,
    00409       const SmartPtr<const VectorSpace> c_space,
    00410       const SmartPtr<const VectorSpace> d_space,
    00411       const SmartPtr<const MatrixSpace> jac_c_space,
    00412       const SmartPtr<const MatrixSpace> jac_d_space,
    00413       const SmartPtr<const SymMatrixSpace> h_space,
    00414       Number& df,
    00415       SmartPtr<Vector>& dx,
    00416       SmartPtr<Vector>& dc,
    00417       SmartPtr<Vector>& dd);
    00418
    00419   private:
    00420
    00429
    00431     NoNLPScalingObject(const NoNLPScalingObject&);
    00432
    00434     void operator=(const NoNLPScalingObject&);
    00436   };
    00437
    00438 } // namespace Ipopt
    00439
    00440 #endif