- Main Page
- Classes
- Files

- File List
- File Members

# src/Algorithm/IpRestoIpoptNLP.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 Eclipse Public License.
    00004 //
    00005 // $Id: IpRestoIpoptNLP.hpp 2594 2015-08-09 14:31:05Z stefan $
    00006 //
    00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
    00008
    00009 #ifndef __IPRESTOIPOPTNLP_HPP__
    00010 #define __IPRESTOIPOPTNLP_HPP__
    00011
    00012 #include "IpIpoptNLP.hpp"
    00013 #include "IpIpoptData.hpp"
    00014 #include "IpIpoptCalculatedQuantities.hpp"
    00015 #include "IpCompoundMatrix.hpp"
    00016 #include "IpCompoundSymMatrix.hpp"
    00017 #include "IpCompoundVector.hpp"
    00018 #include "IpIdentityMatrix.hpp"
    00019 #include "IpDiagMatrix.hpp"
    00020 #include "IpZeroMatrix.hpp"
    00021 #include "IpOrigIpoptNLP.hpp"
    00022
    00023 namespace Ipopt
    00024 {
    00025
    00032   class RestoIpoptNLP : public IpoptNLP
    00033   {
    00034   public:
    00037     RestoIpoptNLP(IpoptNLP& orig_ip_nlp,
    00038                   IpoptData& orig_ip_data,
    00039                   IpoptCalculatedQuantities& orig_ip_cq);
    00040
    00042     ~RestoIpoptNLP();
    00044
    00046     virtual bool Initialize(const Journalist& jnlst,
    00047                             const OptionsList& options,
    00048                             const std::string& prefix);
    00049
    00052     virtual bool InitializeStructures(SmartPtr<Vector>& x,
    00053                                       bool init_x,
    00054                                       SmartPtr<Vector>& y_c,
    00055                                       bool init_y_c,
    00056                                       SmartPtr<Vector>& y_d,
    00057                                       bool init_y_d,
    00058                                       SmartPtr<Vector>& z_L,
    00059                                       bool init_z_L,
    00060                                       SmartPtr<Vector>& z_U,
    00061                                       bool init_z_U,
    00062                                       SmartPtr<Vector>& v_L,
    00063                                       SmartPtr<Vector>& v_U
    00064                                      );
    00065
    00067     virtual bool GetWarmStartIterate(IteratesVector& warm_start_iterate)
    00068     {
    00069       return false;
    00070     }
    00071
    00074     void FinalizeSolution(SolverReturn status,
    00075                           const Vector& x, const Vector& z_L, const Vector& z_U,
    00076                           const Vector& c, const Vector& d,
    00077                           const Vector& y_c, const Vector& y_d,
    00078                           Number obj_value,
    00079                           const IpoptData* ip_data,
    00080                           IpoptCalculatedQuantities* ip_cq)
    00081     {}
    00083
    00089     virtual bool objective_depends_on_mu() const
    00090     {
    00091       return true;
    00092     }
    00093
    00095     virtual Number f(const Vector& x);
    00096
    00098     virtual Number f(const Vector& x, Number mu);
    00099
    00101     virtual SmartPtr<const Vector> grad_f(const Vector& x);
    00102
    00104     virtual SmartPtr<const Vector> grad_f(const Vector& x, Number mu);
    00105
    00107     virtual SmartPtr<const Vector> c(const Vector& x);
    00108
    00110     virtual SmartPtr<const Matrix> jac_c(const Vector& x);
    00111
    00114     virtual SmartPtr<const Vector> d(const Vector& x);
    00115
    00117     virtual SmartPtr<const Matrix> jac_d(const Vector& x);
    00118
    00121     virtual SmartPtr<const SymMatrix> h(const Vector& x,
    00122                                         Number obj_factor,
    00123                                         const Vector& yc,
    00124                                         const Vector& yd
    00125                                        );
    00126
    00128     virtual SmartPtr<const SymMatrix> h(const Vector& x,
    00129                                         Number obj_factor,
    00130                                         const Vector& yc,
    00131                                         const Vector& yd,
    00132                                         Number mu);
    00133
    00137     virtual SmartPtr<const SymMatrix> uninitialized_h();
    00138
    00140     virtual SmartPtr<const Vector> x_L() const
    00141     {
    00142       return GetRawPtr(x_L_);
    00143     }
    00144
    00146     virtual SmartPtr<const Matrix> Px_L() const
    00147     {
    00148       return GetRawPtr(Px_L_);
    00149     }
    00150
    00152     virtual SmartPtr<const Vector> x_U() const
    00153     {
    00154       return GetRawPtr(x_U_);
    00155     }
    00156
    00158     virtual SmartPtr<const Matrix> Px_U() const
    00159     {
    00160       return GetRawPtr(Px_U_);
    00161     }
    00162
    00164     virtual SmartPtr<const Vector> d_L() const
    00165     {
    00166       return GetRawPtr(d_L_);
    00167     }
    00168
    00170     virtual SmartPtr<const Matrix> Pd_L() const
    00171     {
    00172       return GetRawPtr(Pd_L_);
    00173     }
    00174
    00176     virtual SmartPtr<const Vector> d_U() const
    00177     {
    00178       return GetRawPtr(d_U_);
    00179     }
    00180
    00182     virtual SmartPtr<const Matrix> Pd_U() const
    00183     {
    00184       return GetRawPtr(Pd_U_);
    00185     }
    00186
    00187     virtual SmartPtr<const SymMatrixSpace> HessianMatrixSpace() const
    00188     {
    00189       return GetRawPtr(h_space_);
    00190     }
    00191
    00192     virtual SmartPtr<const VectorSpace> x_space() const
    00193     {
    00194       return GetRawPtr(x_space_);
    00195     }
    00197
    00199     virtual void GetSpaces(SmartPtr<const VectorSpace>& x_space,
    00200                            SmartPtr<const VectorSpace>& c_space,
    00201                            SmartPtr<const VectorSpace>& d_space,
    00202                            SmartPtr<const VectorSpace>& x_l_space,
    00203                            SmartPtr<const MatrixSpace>& px_l_space,
    00204                            SmartPtr<const VectorSpace>& x_u_space,
    00205                            SmartPtr<const MatrixSpace>& px_u_space,
    00206                            SmartPtr<const VectorSpace>& d_l_space,
    00207                            SmartPtr<const MatrixSpace>& pd_l_space,
    00208                            SmartPtr<const VectorSpace>& d_u_space,
    00209                            SmartPtr<const MatrixSpace>& pd_u_space,
    00210                            SmartPtr<const MatrixSpace>& Jac_c_space,
    00211                            SmartPtr<const MatrixSpace>& Jac_d_space,
    00212                            SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space);
    00215     virtual void AdjustVariableBounds(const Vector& new_x_L,
    00216                                       const Vector& new_x_U,
    00217                                       const Vector& new_d_L,
    00218                                       const Vector& new_d_U);
    00219
    00221     bool IntermediateCallBack(AlgorithmMode mode,
    00222                               Index iter, Number obj_value,
    00223                               Number inf_pr, Number inf_du,
    00224                               Number mu, Number d_norm,
    00225                               Number regularization_size,
    00226                               Number alpha_du, Number alpha_pr,
    00227                               Index ls_trials,
    00228                               SmartPtr<const IpoptData> ip_data,
    00229                               SmartPtr<IpoptCalculatedQuantities> ip_cq);
    00230
    00234     IpoptNLP& OrigIpNLP() const
    00235     {
    00236       return *orig_ip_nlp_;
    00237     }
    00238     IpoptData& OrigIpData() const
    00239     {
    00240       return *orig_ip_data_;
    00241     }
    00242     IpoptCalculatedQuantities& OrigIpCq() const
    00243     {
    00244       return *orig_ip_cq_;
    00245     }
    00247
    00250     Number Rho() const
    00251     {
    00252       return rho_;
    00253     }
    00254
    00257     virtual Index f_evals() const
    00258     {
    00259       return f_evals_;
    00260     }
    00261     virtual Index grad_f_evals() const
    00262     {
    00263       return grad_f_evals_;
    00264     }
    00265     virtual Index c_evals() const
    00266     {
    00267       return c_evals_;
    00268     }
    00269     virtual Index jac_c_evals() const
    00270     {
    00271       return jac_c_evals_;
    00272     }
    00273     virtual Index d_evals() const
    00274     {
    00275       return d_evals_;
    00276     }
    00277     virtual Index jac_d_evals() const
    00278     {
    00279       return jac_d_evals_;
    00280     }
    00281     virtual Index h_evals() const
    00282     {
    00283       return h_evals_;
    00284     }
    00286
    00288     Number Eta(Number mu) const;
    00289
    00292     SmartPtr<const Vector> DR_x() const
    00293     {
    00294       return ConstPtr(dr_x_);
    00295     }
    00296
    00300     static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
    00302
    00303   private:
    00307     SmartPtr<IpoptNLP> orig_ip_nlp_;
    00308
    00310     SmartPtr<IpoptData> orig_ip_data_;
    00311
    00313     SmartPtr<IpoptCalculatedQuantities> orig_ip_cq_;
    00315
    00318     SmartPtr<CompoundVectorSpace> x_space_;
    00319
    00320     SmartPtr<CompoundVectorSpace> c_space_;
    00321
    00322     SmartPtr<CompoundVectorSpace> d_space_;
    00323
    00324     SmartPtr<CompoundVectorSpace> x_l_space_;
    00325
    00326     SmartPtr<CompoundMatrixSpace> px_l_space_;
    00327
    00328     SmartPtr<CompoundVectorSpace> x_u_space_;
    00329
    00330     SmartPtr<CompoundMatrixSpace> px_u_space_;
    00331
    00332     SmartPtr<CompoundVectorSpace> d_l_space_;
    00333
    00334     SmartPtr<CompoundMatrixSpace> pd_l_space_;
    00335
    00336     SmartPtr<CompoundVectorSpace> d_u_space_;
    00337
    00338     SmartPtr<CompoundMatrixSpace> pd_u_space_;
    00339
    00340     SmartPtr<CompoundMatrixSpace> jac_c_space_;
    00341
    00342     SmartPtr<CompoundMatrixSpace> jac_d_space_;
    00343
    00344     SmartPtr<CompoundSymMatrixSpace> h_space_;
    00346
    00350     SmartPtr<CompoundVector> x_L_;
    00351
    00353     SmartPtr<CompoundMatrix> Px_L_;
    00354
    00356     SmartPtr<CompoundVector> x_U_;
    00357
    00359     SmartPtr<CompoundMatrix> Px_U_;
    00360
    00362     SmartPtr<CompoundVector> d_L_;
    00363
    00365     SmartPtr<CompoundMatrix> Pd_L_;
    00366
    00368     SmartPtr<CompoundVector> d_U_;
    00369
    00371     SmartPtr<CompoundMatrix> Pd_U_;
    00373
    00377     /* ToDo make this parameter? */
    00378     Number rho_;
    00380     Number eta_factor_;
    00382     Number eta_mu_exponent_;
    00383     // TODO in the following we should use pointers to CONST values
    00385     SmartPtr<Vector> dr_x_;
    00386     SmartPtr<DiagMatrix> DR_x_; //TODO We can get rid of one of the dr DR
    00388     SmartPtr<Vector> x_ref_;
    00390
    00400     RestoIpoptNLP();
    00401
    00403     RestoIpoptNLP(const RestoIpoptNLP&);
    00404
    00406     void operator=(const RestoIpoptNLP&);
    00408
    00414     bool evaluate_orig_obj_at_resto_trial_;
    00416     HessianApproximationType hessian_approximation_;
    00418
    00420     bool initialized_;
    00421
    00424     Index f_evals_;
    00425     Index grad_f_evals_;
    00426     Index c_evals_;
    00427     Index jac_c_evals_;
    00428     Index d_evals_;
    00429     Index jac_d_evals_;
    00430     Index h_evals_;
    00432   };
    00433
    00434 } // namespace Ipopt
    00435
    00436 #endif

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines