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 Common Public License.
00004 //
00005 // $Id: IpRestoIpoptNLP.hpp 765 2006-07-14 18:03:23Z andreasw $
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     {}
00081 
00087     virtual bool objective_depends_on_mu() const
00088     {
00089       return true;
00090     }
00091 
00093     virtual Number f(const Vector& x);
00094 
00096     virtual Number f(const Vector& x, Number mu);
00097 
00099     virtual SmartPtr<const Vector> grad_f(const Vector& x);
00100 
00102     virtual SmartPtr<const Vector> grad_f(const Vector& x, Number mu);
00103 
00105     virtual SmartPtr<const Vector> c(const Vector& x);
00106 
00108     virtual SmartPtr<const Matrix> jac_c(const Vector& x);
00109 
00112     virtual SmartPtr<const Vector> d(const Vector& x);
00113 
00115     virtual SmartPtr<const Matrix> jac_d(const Vector& x);
00116 
00119     virtual SmartPtr<const SymMatrix> h(const Vector& x,
00120                                         Number obj_factor,
00121                                         const Vector& yc,
00122                                         const Vector& yd
00123                                        );
00124 
00126     virtual SmartPtr<const SymMatrix> h(const Vector& x,
00127                                         Number obj_factor,
00128                                         const Vector& yc,
00129                                         const Vector& yd,
00130                                         Number mu);
00131 
00135     virtual SmartPtr<const SymMatrix> uninitialized_h();
00136 
00138     virtual SmartPtr<const Vector> x_L()
00139     {
00140       return GetRawPtr(x_L_);
00141     }
00142 
00144     virtual SmartPtr<const Matrix> Px_L()
00145     {
00146       return GetRawPtr(Px_L_);
00147     }
00148 
00150     virtual SmartPtr<const Vector> x_U()
00151     {
00152       return GetRawPtr(x_U_);
00153     }
00154 
00156     virtual SmartPtr<const Matrix> Px_U()
00157     {
00158       return GetRawPtr(Px_U_);
00159     }
00160 
00162     virtual SmartPtr<const Vector> d_L()
00163     {
00164       return GetRawPtr(d_L_);
00165     }
00166 
00168     virtual SmartPtr<const Matrix> Pd_L()
00169     {
00170       return GetRawPtr(Pd_L_);
00171     }
00172 
00174     virtual SmartPtr<const Vector> d_U()
00175     {
00176       return GetRawPtr(d_U_);
00177     }
00178 
00180     virtual SmartPtr<const Matrix> Pd_U()
00181     {
00182       return GetRawPtr(Pd_U_);
00183     }
00184 
00185     virtual SmartPtr<const SymMatrixSpace> HessianMatrixSpace() const
00186     {
00187       return GetRawPtr(h_space_);
00188     }
00190 
00192     virtual void GetSpaces(SmartPtr<const VectorSpace>& x_space,
00193                            SmartPtr<const VectorSpace>& c_space,
00194                            SmartPtr<const VectorSpace>& d_space,
00195                            SmartPtr<const VectorSpace>& x_l_space,
00196                            SmartPtr<const MatrixSpace>& px_l_space,
00197                            SmartPtr<const VectorSpace>& x_u_space,
00198                            SmartPtr<const MatrixSpace>& px_u_space,
00199                            SmartPtr<const VectorSpace>& d_l_space,
00200                            SmartPtr<const MatrixSpace>& pd_l_space,
00201                            SmartPtr<const VectorSpace>& d_u_space,
00202                            SmartPtr<const MatrixSpace>& pd_u_space,
00203                            SmartPtr<const MatrixSpace>& Jac_c_space,
00204                            SmartPtr<const MatrixSpace>& Jac_d_space,
00205                            SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space);
00208     virtual void AdjustVariableBounds(const Vector& new_x_L,
00209                                       const Vector& new_x_U,
00210                                       const Vector& new_d_L,
00211                                       const Vector& new_d_U);
00212 
00214     bool IntermediateCallBack(AlgorithmMode mode,
00215                               Index iter, Number obj_value,
00216                               Number inf_pr, Number inf_du,
00217                               Number mu, Number d_norm,
00218                               Number regularization_size,
00219                               Number alpha_du, Number alpha_pr,
00220                               Index ls_trials,
00221                               SmartPtr<const IpoptData> ip_data,
00222                               SmartPtr<IpoptCalculatedQuantities> ip_cq);
00223 
00227     IpoptNLP& OrigIpNLP() const
00228     {
00229       return *orig_ip_nlp_;
00230     }
00231     IpoptData& OrigIpData() const
00232     {
00233       return *orig_ip_data_;
00234     }
00235     IpoptCalculatedQuantities& OrigIpCq() const
00236     {
00237       return *orig_ip_cq_;
00238     }
00240 
00243     Number Rho() const
00244     {
00245       return rho_;
00246     }
00247 
00250     virtual Index f_evals() const
00251     {
00252       return f_evals_;
00253     }
00254     virtual Index grad_f_evals() const
00255     {
00256       return grad_f_evals_;
00257     }
00258     virtual Index c_evals() const
00259     {
00260       return c_evals_;
00261     }
00262     virtual Index jac_c_evals() const
00263     {
00264       return jac_c_evals_;
00265     }
00266     virtual Index d_evals() const
00267     {
00268       return d_evals_;
00269     }
00270     virtual Index jac_d_evals() const
00271     {
00272       return jac_d_evals_;
00273     }
00274     virtual Index h_evals() const
00275     {
00276       return h_evals_;
00277     }
00279 
00281     Number Eta(Number mu) const;
00282 
00285     SmartPtr<const Vector> DR_x() const
00286     {
00287       return ConstPtr(dr_x_);
00288     }
00289 
00293     static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
00295 
00296   private:
00300     SmartPtr<IpoptNLP> orig_ip_nlp_;
00301 
00303     SmartPtr<IpoptData> orig_ip_data_;
00304 
00306     SmartPtr<IpoptCalculatedQuantities> orig_ip_cq_;
00308 
00311     SmartPtr<CompoundVectorSpace> x_space_;
00312 
00313     SmartPtr<const VectorSpace> c_space_;
00314 
00315     SmartPtr<const VectorSpace> d_space_;
00316 
00317     SmartPtr<CompoundVectorSpace> x_l_space_;
00318 
00319     SmartPtr<CompoundMatrixSpace> px_l_space_;
00320 
00321     SmartPtr<const VectorSpace> x_u_space_;
00322 
00323     SmartPtr<CompoundMatrixSpace> px_u_space_;
00324 
00325     SmartPtr<const VectorSpace> d_l_space_;
00326 
00327     SmartPtr<const MatrixSpace> pd_l_space_;
00328 
00329     SmartPtr<const VectorSpace> d_u_space_;
00330 
00331     SmartPtr<const MatrixSpace> pd_u_space_;
00332 
00333     SmartPtr<CompoundMatrixSpace> jac_c_space_;
00334 
00335     SmartPtr<CompoundMatrixSpace> jac_d_space_;
00336 
00337     SmartPtr<CompoundSymMatrixSpace> h_space_;
00339 
00343     SmartPtr<CompoundVector> x_L_;
00344 
00346     SmartPtr<CompoundMatrix> Px_L_;
00347 
00349     SmartPtr<const Vector> x_U_;
00350 
00352     SmartPtr<CompoundMatrix> Px_U_;
00353 
00355     SmartPtr<const Vector> d_L_;
00356 
00358     SmartPtr<const Matrix> Pd_L_;
00359 
00361     SmartPtr<const Vector> d_U_;
00362 
00364     SmartPtr<const Matrix> Pd_U_;
00366 
00370     /* ToDo make this parameter? */
00371     Number rho_;
00373     Number eta_factor_;
00375     Number eta_mu_exponent_;
00376     // TODO in the following we should use pointers to CONST values
00378     SmartPtr<Vector> dr_x_;
00379     SmartPtr<DiagMatrix> DR_x_; //TODO We can get rid of one of the dr DR
00381     SmartPtr<Vector> x_ref_;
00383 
00393     RestoIpoptNLP();
00394 
00396     RestoIpoptNLP(const RestoIpoptNLP&);
00397 
00399     void operator=(const RestoIpoptNLP&);
00401 
00407     bool evaluate_orig_obj_at_resto_trial_;
00409     HessianApproximationType hessian_approximation_;
00411 
00413     bool initialized_;
00414 
00417     Index f_evals_;
00418     Index grad_f_evals_;
00419     Index c_evals_;
00420     Index jac_c_evals_;
00421     Index d_evals_;
00422     Index jac_d_evals_;
00423     Index h_evals_;
00425   };
00426 
00427 } // namespace Ipopt
00428 
00429 #endif

Generated on Fri Sep 26 07:44:12 2008 for SimTKcore by  doxygen 1.5.6