/home/coin/SVN-release/Ipopt-3.2.2/Ipopt/src/Algorithm/IpOrigIpoptNLP.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: IpOrigIpoptNLP.hpp 765 2006-07-14 18:03:23Z andreasw $
00006 //
00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
00008 
00009 #ifndef __IPORIGIPOPTNLP_HPP__
00010 #define __IPORIGIPOPTNLP_HPP__
00011 
00012 #include "IpIpoptNLP.hpp"
00013 #include "IpException.hpp"
00014 #include "IpTimingStatistics.hpp"
00015 
00016 namespace Ipopt
00017 {
00018 
00020   enum HessianApproximationType {
00021     EXACT=0,
00022     LIMITED_MEMORY
00023   };
00024 
00031   class OrigIpoptNLP : public IpoptNLP
00032   {
00033   public:
00036     OrigIpoptNLP(const SmartPtr<const Journalist>& jnlst,
00037                  const SmartPtr<NLP>& nlp,
00038                  const SmartPtr<NLPScalingObject>& nlp_scaling);
00039 
00041     virtual ~OrigIpoptNLP();
00043 
00045     virtual bool Initialize(const Journalist& jnlst,
00046                             const OptionsList& options,
00047                             const std::string& prefix);
00048 
00051     virtual bool InitializeStructures(SmartPtr<Vector>& x,
00052                                       bool init_x,
00053                                       SmartPtr<Vector>& y_c,
00054                                       bool init_y_c,
00055                                       SmartPtr<Vector>& y_d,
00056                                       bool init_y_d,
00057                                       SmartPtr<Vector>& z_L,
00058                                       bool init_z_L,
00059                                       SmartPtr<Vector>& z_U,
00060                                       bool init_z_U,
00061                                       SmartPtr<Vector>& v_L,
00062                                       SmartPtr<Vector>& v_U
00063                                      );
00064 
00066     virtual bool GetWarmStartIterate(IteratesVector& warm_start_iterate)
00067     {
00068       return nlp_->GetWarmStartIterate(warm_start_iterate);
00069     }
00073     virtual Number f(const Vector& x);
00074 
00077     virtual Number f(const Vector& x, Number mu);
00078 
00080     virtual SmartPtr<const Vector> grad_f(const Vector& x);
00081 
00084     virtual SmartPtr<const Vector> grad_f(const Vector& x, Number mu);
00085 
00087     virtual SmartPtr<const Vector> c(const Vector& x);
00088 
00090     virtual SmartPtr<const Matrix> jac_c(const Vector& x);
00091 
00094     virtual SmartPtr<const Vector> d(const Vector& x);
00095 
00097     virtual SmartPtr<const Matrix> jac_d(const Vector& x);
00098 
00100     virtual SmartPtr<const SymMatrix> h(const Vector& x,
00101                                         Number obj_factor,
00102                                         const Vector& yc,
00103                                         const Vector& yd
00104                                        );
00105 
00108     virtual SmartPtr<const SymMatrix> h(const Vector& x,
00109                                         Number obj_factor,
00110                                         const Vector& yc,
00111                                         const Vector& yd,
00112                                         Number mu);
00113 
00117     virtual SmartPtr<const SymMatrix> uninitialized_h();
00118 
00120     virtual SmartPtr<const Vector> x_L()
00121     {
00122       return x_L_;
00123     }
00124 
00126     virtual SmartPtr<const Matrix> Px_L()
00127     {
00128       return Px_L_;
00129     }
00130 
00132     virtual SmartPtr<const Vector> x_U()
00133     {
00134       return x_U_;
00135     }
00136 
00138     virtual SmartPtr<const Matrix> Px_U()
00139     {
00140       return Px_U_;
00141     }
00142 
00144     virtual SmartPtr<const Vector> d_L()
00145     {
00146       return d_L_;
00147     }
00148 
00150     virtual SmartPtr<const Matrix> Pd_L()
00151     {
00152       return Pd_L_;
00153     }
00154 
00156     virtual SmartPtr<const Vector> d_U()
00157     {
00158       return d_U_;
00159     }
00160 
00162     virtual SmartPtr<const Matrix> Pd_U()
00163     {
00164       return Pd_U_;
00165     }
00166 
00167     virtual SmartPtr<const SymMatrixSpace> HessianMatrixSpace() const
00168     {
00169       return h_space_;
00170     }
00172 
00174     virtual void GetSpaces(SmartPtr<const VectorSpace>& x_space,
00175                            SmartPtr<const VectorSpace>& c_space,
00176                            SmartPtr<const VectorSpace>& d_space,
00177                            SmartPtr<const VectorSpace>& x_l_space,
00178                            SmartPtr<const MatrixSpace>& px_l_space,
00179                            SmartPtr<const VectorSpace>& x_u_space,
00180                            SmartPtr<const MatrixSpace>& px_u_space,
00181                            SmartPtr<const VectorSpace>& d_l_space,
00182                            SmartPtr<const MatrixSpace>& pd_l_space,
00183                            SmartPtr<const VectorSpace>& d_u_space,
00184                            SmartPtr<const MatrixSpace>& pd_u_space,
00185                            SmartPtr<const MatrixSpace>& Jac_c_space,
00186                            SmartPtr<const MatrixSpace>& Jac_d_space,
00187                            SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space);
00188 
00191     virtual void AdjustVariableBounds(const Vector& new_x_L,
00192                                       const Vector& new_x_U,
00193                                       const Vector& new_d_L,
00194                                       const Vector& new_d_U);
00195 
00198     virtual Index f_evals() const
00199     {
00200       return f_evals_;
00201     }
00202     virtual Index grad_f_evals() const
00203     {
00204       return grad_f_evals_;
00205     }
00206     virtual Index c_evals() const
00207     {
00208       return c_evals_;
00209     }
00210     virtual Index jac_c_evals() const
00211     {
00212       return jac_c_evals_;
00213     }
00214     virtual Index d_evals() const
00215     {
00216       return d_evals_;
00217     }
00218     virtual Index jac_d_evals() const
00219     {
00220       return jac_d_evals_;
00221     }
00222     virtual Index h_evals() const
00223     {
00224       return h_evals_;
00225     }
00227 
00230     void FinalizeSolution(SolverReturn status,
00231                           const Vector& x, const Vector& z_L, const Vector& z_U,
00232                           const Vector& c, const Vector& d,
00233                           const Vector& y_c, const Vector& y_d,
00234                           Number obj_value);
00235     bool IntermediateCallBack(AlgorithmMode mode,
00236                               Index iter, Number obj_value,
00237                               Number inf_pr, Number inf_du,
00238                               Number mu, Number d_norm,
00239                               Number regularization_size,
00240                               Number alpha_du, Number alpha_pr,
00241                               Index ls_trials,
00242                               SmartPtr<const IpoptData> ip_data,
00243                               SmartPtr<IpoptCalculatedQuantities> ip_cq);
00245 
00249     static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
00251 
00253     SmartPtr<NLP> nlp()
00254     {
00255       return nlp_;
00256     }
00257 
00258     void PrintTimingStatistics(Journalist& jnlst,
00259                                EJournalLevel level,
00260                                EJournalCategory category) const;
00261 
00262     Number TotalFunctionEvaluationCPUTime() const;
00263 
00264   private:
00266     SmartPtr<const Journalist> jnlst_;
00267 
00269     SmartPtr<NLP> nlp_;
00270 
00273     SmartPtr<const VectorSpace> x_space_;
00274     SmartPtr<const VectorSpace> c_space_;
00275     SmartPtr<const VectorSpace> d_space_;
00276     SmartPtr<const VectorSpace> x_l_space_;
00277     SmartPtr<const MatrixSpace> px_l_space_;
00278     SmartPtr<const VectorSpace> x_u_space_;
00279     SmartPtr<const MatrixSpace> px_u_space_;
00280     SmartPtr<const VectorSpace> d_l_space_;
00281     SmartPtr<const MatrixSpace> pd_l_space_;
00282     SmartPtr<const VectorSpace> d_u_space_;
00283     SmartPtr<const MatrixSpace> pd_u_space_;
00284     SmartPtr<const MatrixSpace> jac_c_space_;
00285     SmartPtr<const MatrixSpace> jac_d_space_;
00286     SmartPtr<const SymMatrixSpace> h_space_;
00287 
00288     SmartPtr<const MatrixSpace> scaled_jac_c_space_;
00289     SmartPtr<const MatrixSpace> scaled_jac_d_space_;
00290     SmartPtr<const SymMatrixSpace> scaled_h_space_;
00292 
00295     CachedResults<Number> f_cache_;
00296 
00298     CachedResults<SmartPtr<const Vector> > grad_f_cache_;
00299 
00301     CachedResults<SmartPtr<const Vector> > c_cache_;
00302 
00305     CachedResults<SmartPtr<const Matrix> > jac_c_cache_;
00306 
00309     CachedResults<SmartPtr<const Vector> > d_cache_;
00310 
00313     CachedResults<SmartPtr<const Matrix> > jac_d_cache_;
00314 
00317     CachedResults<SmartPtr<const SymMatrix> > h_cache_;
00318 
00320     SmartPtr<const Vector> x_L_;
00321 
00323     SmartPtr<const Matrix> Px_L_;
00324 
00326     SmartPtr<const Vector> x_U_;
00327 
00329     SmartPtr<const Matrix> Px_U_;
00330 
00332     SmartPtr<const Vector> d_L_;
00333 
00335     SmartPtr<const Matrix> Pd_L_;
00336 
00338     SmartPtr<const Vector> d_U_;
00339 
00341     SmartPtr<const Matrix> Pd_U_;
00342 
00344     SmartPtr<const Vector> orig_x_L_;
00345 
00347     SmartPtr<const Vector> orig_x_U_;
00349 
00359     OrigIpoptNLP();
00360 
00362     OrigIpoptNLP(const OrigIpoptNLP&);
00363 
00365     void operator=(const OrigIpoptNLP&);
00367 
00374     void relax_bounds(Number bound_relax_factor, Vector& bounds);
00376 
00380     Number bound_relax_factor_;
00383     bool honor_original_bounds_;
00386     bool warm_start_same_structure_;
00388     HessianApproximationType hessian_approximation_;
00391     bool check_derivatives_for_naninf_;
00393 
00396     Index f_evals_;
00397     Index grad_f_evals_;
00398     Index c_evals_;
00399     Index jac_c_evals_;
00400     Index d_evals_;
00401     Index jac_d_evals_;
00402     Index h_evals_;
00404 
00406     bool initialized_;
00407 
00410     TimedTask f_eval_time_;
00411     TimedTask grad_f_eval_time_;
00412     TimedTask c_eval_time_;
00413     TimedTask jac_c_eval_time_;
00414     TimedTask d_eval_time_;
00415     TimedTask jac_d_eval_time_;
00416     TimedTask h_eval_time_;
00418   };
00419 
00420 } // namespace Ipopt
00421 
00422 #endif

Generated on Thu May 15 22:19:49 2008 by  doxygen 1.4.7