Ipopt
trunk
|
00001 // Copyright (C) 2008, 2010 International Business Machines and others. 00002 // All Rights Reserved. 00003 // This code is published under the Eclipse Public License. 00004 // 00005 // $Id: IpNLP.hpp 949 2007-03-27 00:41:26Z andreasw $ 00006 // 00007 // Authors: Andreas Waechter IBM 2008-08-25 00008 00009 #ifndef __IPNLPBOUNDSREMOVER_HPP__ 00010 #define __IPNLPBOUNDSREMOVER_HPP__ 00011 00012 #include "IpNLP.hpp" 00013 00014 namespace Ipopt 00015 { 00024 class NLPBoundsRemover : public NLP 00025 { 00026 public: 00031 NLPBoundsRemover(NLP& nlp, bool allow_twosided_inequalities = false); 00032 00034 virtual ~NLPBoundsRemover() 00035 {} 00037 00043 virtual bool ProcessOptions(const OptionsList& options, 00044 const std::string& prefix) 00045 { 00046 return nlp_->ProcessOptions(options, prefix); 00047 } 00048 00052 virtual bool GetSpaces(SmartPtr<const VectorSpace>& x_space, 00053 SmartPtr<const VectorSpace>& c_space, 00054 SmartPtr<const VectorSpace>& d_space, 00055 SmartPtr<const VectorSpace>& x_l_space, 00056 SmartPtr<const MatrixSpace>& px_l_space, 00057 SmartPtr<const VectorSpace>& x_u_space, 00058 SmartPtr<const MatrixSpace>& px_u_space, 00059 SmartPtr<const VectorSpace>& d_l_space, 00060 SmartPtr<const MatrixSpace>& pd_l_space, 00061 SmartPtr<const VectorSpace>& d_u_space, 00062 SmartPtr<const MatrixSpace>& pd_u_space, 00063 SmartPtr<const MatrixSpace>& Jac_c_space, 00064 SmartPtr<const MatrixSpace>& Jac_d_space, 00065 SmartPtr<const SymMatrixSpace>& Hess_lagrangian_space); 00066 00068 virtual bool GetBoundsInformation(const Matrix& Px_L, 00069 Vector& x_L, 00070 const Matrix& Px_U, 00071 Vector& x_U, 00072 const Matrix& Pd_L, 00073 Vector& d_L, 00074 const Matrix& Pd_U, 00075 Vector& d_U); 00076 00080 virtual bool GetStartingPoint(SmartPtr<Vector> x, 00081 bool need_x, 00082 SmartPtr<Vector> y_c, 00083 bool need_y_c, 00084 SmartPtr<Vector> y_d, 00085 bool need_y_d, 00086 SmartPtr<Vector> z_L, 00087 bool need_z_L, 00088 SmartPtr<Vector> z_U, 00089 bool need_z_U); 00090 00094 virtual bool GetWarmStartIterate(IteratesVector& warm_start_iterate) 00095 { 00096 return nlp_->GetWarmStartIterate(warm_start_iterate); 00097 } 00099 00103 virtual bool Eval_f(const Vector& x, Number& f) 00104 { 00105 return nlp_->Eval_f(x, f); 00106 } 00107 00108 virtual bool Eval_grad_f(const Vector& x, Vector& g_f) 00109 { 00110 return nlp_->Eval_grad_f(x, g_f); 00111 } 00112 00113 virtual bool Eval_c(const Vector& x, Vector& c) 00114 { 00115 return nlp_->Eval_c(x, c); 00116 } 00117 00118 virtual bool Eval_jac_c(const Vector& x, Matrix& jac_c) 00119 { 00120 return nlp_->Eval_jac_c(x, jac_c); 00121 } 00122 00123 virtual bool Eval_d(const Vector& x, Vector& d); 00124 00125 virtual bool Eval_jac_d(const Vector& x, Matrix& jac_d); 00126 00127 virtual bool Eval_h(const Vector& x, 00128 Number obj_factor, 00129 const Vector& yc, 00130 const Vector& yd, 00131 SymMatrix& h); 00133 00142 virtual void FinalizeSolution(SolverReturn status, 00143 const Vector& x, const Vector& z_L, 00144 const Vector& z_U, 00145 const Vector& c, const Vector& d, 00146 const Vector& y_c, const Vector& y_d, 00147 Number obj_value, 00148 const IpoptData* ip_data, 00149 IpoptCalculatedQuantities* ip_cq); 00150 00166 virtual bool IntermediateCallBack(AlgorithmMode mode, 00167 Index iter, Number obj_value, 00168 Number inf_pr, Number inf_du, 00169 Number mu, Number d_norm, 00170 Number regularization_size, 00171 Number alpha_du, Number alpha_pr, 00172 Index ls_trials, 00173 const IpoptData* ip_data, 00174 IpoptCalculatedQuantities* ip_cq) 00175 { 00176 return nlp_->IntermediateCallBack(mode,iter, obj_value, inf_pr, inf_du, 00177 mu, d_norm, regularization_size, 00178 alpha_du, alpha_pr, ls_trials, 00179 ip_data, ip_cq); 00180 } 00182 00187 virtual void GetScalingParameters( 00188 const SmartPtr<const VectorSpace> x_space, 00189 const SmartPtr<const VectorSpace> c_space, 00190 const SmartPtr<const VectorSpace> d_space, 00191 Number& obj_scaling, 00192 SmartPtr<Vector>& x_scaling, 00193 SmartPtr<Vector>& c_scaling, 00194 SmartPtr<Vector>& d_scaling) const; 00196 00210 virtual void 00211 GetQuasiNewtonApproximationSpaces(SmartPtr<VectorSpace>& approx_space, 00212 SmartPtr<Matrix>& P_approx) 00213 { 00214 nlp_->GetQuasiNewtonApproximationSpaces(approx_space, P_approx); 00215 } 00216 00218 SmartPtr<NLP> nlp() 00219 { 00220 return nlp_; 00221 } 00222 00223 private: 00233 NLPBoundsRemover(); 00235 NLPBoundsRemover(const NLPBoundsRemover&); 00236 00238 void operator=(const NLPBoundsRemover&); 00240 00242 SmartPtr<NLP> nlp_; 00243 00245 SmartPtr<const Matrix> Px_l_orig_; 00246 00248 SmartPtr<const Matrix> Px_u_orig_; 00249 00251 SmartPtr<const VectorSpace> d_space_orig_; 00252 00255 bool allow_twosided_inequalities_; 00256 }; 00257 00258 } // namespace Ipopt 00259 00260 #endif