00001
00002
00003
00004
00005
00006
00007
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 }
00192
00194 virtual void GetSpaces(SmartPtr<const VectorSpace>& x_space,
00195 SmartPtr<const VectorSpace>& c_space,
00196 SmartPtr<const VectorSpace>& d_space,
00197 SmartPtr<const VectorSpace>& x_l_space,
00198 SmartPtr<const MatrixSpace>& px_l_space,
00199 SmartPtr<const VectorSpace>& x_u_space,
00200 SmartPtr<const MatrixSpace>& px_u_space,
00201 SmartPtr<const VectorSpace>& d_l_space,
00202 SmartPtr<const MatrixSpace>& pd_l_space,
00203 SmartPtr<const VectorSpace>& d_u_space,
00204 SmartPtr<const MatrixSpace>& pd_u_space,
00205 SmartPtr<const MatrixSpace>& Jac_c_space,
00206 SmartPtr<const MatrixSpace>& Jac_d_space,
00207 SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space);
00210 virtual void AdjustVariableBounds(const Vector& new_x_L,
00211 const Vector& new_x_U,
00212 const Vector& new_d_L,
00213 const Vector& new_d_U);
00214
00216 bool IntermediateCallBack(AlgorithmMode mode,
00217 Index iter, Number obj_value,
00218 Number inf_pr, Number inf_du,
00219 Number mu, Number d_norm,
00220 Number regularization_size,
00221 Number alpha_du, Number alpha_pr,
00222 Index ls_trials,
00223 SmartPtr<const IpoptData> ip_data,
00224 SmartPtr<IpoptCalculatedQuantities> ip_cq);
00225
00229 IpoptNLP& OrigIpNLP() const
00230 {
00231 return *orig_ip_nlp_;
00232 }
00233 IpoptData& OrigIpData() const
00234 {
00235 return *orig_ip_data_;
00236 }
00237 IpoptCalculatedQuantities& OrigIpCq() const
00238 {
00239 return *orig_ip_cq_;
00240 }
00242
00245 Number Rho() const
00246 {
00247 return rho_;
00248 }
00249
00252 virtual Index f_evals() const
00253 {
00254 return f_evals_;
00255 }
00256 virtual Index grad_f_evals() const
00257 {
00258 return grad_f_evals_;
00259 }
00260 virtual Index c_evals() const
00261 {
00262 return c_evals_;
00263 }
00264 virtual Index jac_c_evals() const
00265 {
00266 return jac_c_evals_;
00267 }
00268 virtual Index d_evals() const
00269 {
00270 return d_evals_;
00271 }
00272 virtual Index jac_d_evals() const
00273 {
00274 return jac_d_evals_;
00275 }
00276 virtual Index h_evals() const
00277 {
00278 return h_evals_;
00279 }
00281
00283 Number Eta(Number mu) const;
00284
00287 SmartPtr<const Vector> DR_x() const
00288 {
00289 return ConstPtr(dr_x_);
00290 }
00291
00295 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
00297
00298 private:
00302 SmartPtr<IpoptNLP> orig_ip_nlp_;
00303
00305 SmartPtr<IpoptData> orig_ip_data_;
00306
00308 SmartPtr<IpoptCalculatedQuantities> orig_ip_cq_;
00310
00313 SmartPtr<CompoundVectorSpace> x_space_;
00314
00315 SmartPtr<const VectorSpace> c_space_;
00316
00317 SmartPtr<const VectorSpace> d_space_;
00318
00319 SmartPtr<CompoundVectorSpace> x_l_space_;
00320
00321 SmartPtr<CompoundMatrixSpace> px_l_space_;
00322
00323 SmartPtr<const VectorSpace> x_u_space_;
00324
00325 SmartPtr<CompoundMatrixSpace> px_u_space_;
00326
00327 SmartPtr<const VectorSpace> d_l_space_;
00328
00329 SmartPtr<const MatrixSpace> pd_l_space_;
00330
00331 SmartPtr<const VectorSpace> d_u_space_;
00332
00333 SmartPtr<const MatrixSpace> pd_u_space_;
00334
00335 SmartPtr<CompoundMatrixSpace> jac_c_space_;
00336
00337 SmartPtr<CompoundMatrixSpace> jac_d_space_;
00338
00339 SmartPtr<CompoundSymMatrixSpace> h_space_;
00341
00345 SmartPtr<CompoundVector> x_L_;
00346
00348 SmartPtr<CompoundMatrix> Px_L_;
00349
00351 SmartPtr<const Vector> x_U_;
00352
00354 SmartPtr<CompoundMatrix> Px_U_;
00355
00357 SmartPtr<const Vector> d_L_;
00358
00360 SmartPtr<const Matrix> Pd_L_;
00361
00363 SmartPtr<const Vector> d_U_;
00364
00366 SmartPtr<const Matrix> Pd_U_;
00368
00372
00373 Number rho_;
00375 Number eta_factor_;
00377 Number eta_mu_exponent_;
00378
00380 SmartPtr<Vector> dr_x_;
00381 SmartPtr<DiagMatrix> DR_x_;
00383 SmartPtr<Vector> x_ref_;
00385
00395 RestoIpoptNLP();
00396
00398 RestoIpoptNLP(const RestoIpoptNLP&);
00399
00401 void operator=(const RestoIpoptNLP&);
00403
00409 bool evaluate_orig_obj_at_resto_trial_;
00411 HessianApproximationType hessian_approximation_;
00413
00415 bool initialized_;
00416
00419 Index f_evals_;
00420 Index grad_f_evals_;
00421 Index c_evals_;
00422 Index jac_c_evals_;
00423 Index d_evals_;
00424 Index jac_d_evals_;
00425 Index h_evals_;
00427 };
00428
00429 }
00430
00431 #endif