00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __IPTNLP_HPP__
00010 #define __IPTNLP_HPP__
00011
00012 #include "IpUtils.hpp"
00013 #include "IpReferenced.hpp"
00014 #include "IpException.hpp"
00015 #include "IpAlgTypes.hpp"
00016 #include "IpReturnCodes.hpp"
00017
00018 namespace Ipopt
00019 {
00020
00021 class IpoptData;
00022 class IpoptCalculatedQuantities;
00023 class IteratesVector;
00024
00048 class TNLP : public ReferencedObject
00049 {
00050 public:
00053 TNLP()
00054 {}
00055 ;
00056
00058 virtual ~TNLP()
00059 {}
00060 ;
00062
00063 DECLARE_STD_EXCEPTION(INVALID_TNLP);
00064
00073 enum IndexStyleEnum { C_STYLE=0, FORTRAN_STYLE=1 };
00074 virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00075 Index& nnz_h_lag, IndexStyleEnum& index_style)=0;
00076
00083 virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00084 Index m, Number* g_l, Number* g_u)=0;
00085
00093 virtual bool get_scaling_parameters(Number& obj_scaling,
00094 bool& use_x_scaling, Index n,
00095 Number* x_scaling,
00096 bool& use_g_scaling, Index m,
00097 Number* g_scaling)
00098 {
00099 return false;
00100 }
00101
00109 virtual bool get_starting_point(Index n, bool init_x, Number* x,
00110 bool init_z, Number* z_L, Number* z_U,
00111 Index m, bool init_lambda,
00112 Number* lambda)=0;
00113
00118 virtual bool get_warm_start_iterate(IteratesVector& warm_start_iterate)
00119 {
00120 return false;
00121 }
00122
00124 virtual bool eval_f(Index n, const Number* x, bool new_x,
00125 Number& obj_value)=0;
00126
00129 virtual bool eval_grad_f(Index n, const Number* x, bool new_x,
00130 Number* grad_f)=0;
00131
00133 virtual bool eval_g(Index n, const Number* x, bool new_x,
00134 Index m, Number* g)=0;
00140 virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00141 Index m, Index nele_jac, Index* iRow,
00142 Index *jCol, Number* values)=0;
00143
00153 virtual bool eval_h(Index n, const Number* x, bool new_x,
00154 Number obj_factor, Index m, const Number* lambda,
00155 bool new_lambda, Index nele_hess,
00156 Index* iRow, Index* jCol, Number* values)
00157 {
00158 return false;
00159 }
00161
00165 virtual void finalize_solution(SolverReturn status,
00166 Index n, const Number* x, const Number* z_L, const Number* z_U,
00167 Index m, const Number* g, const Number* lambda,
00168 Number obj_value)=0;
00169
00173 virtual bool intermediate_callback(AlgorithmMode mode,
00174 Index iter, Number obj_value,
00175 Number inf_pr, Number inf_du,
00176 Number mu, Number d_norm,
00177 Number regularization_size,
00178 Number alpha_du, Number alpha_pr,
00179 Index ls_trials,
00180 const IpoptData* ip_data,
00181 IpoptCalculatedQuantities* ip_cq)
00182 {
00183 return true;
00184 }
00186
00200 virtual Index get_number_of_nonlinear_variables()
00201 {
00202 return -1;
00203 }
00204
00205 virtual bool get_list_of_nonlinear_variables(Index num_nonlin_vars,
00206 Index* pos_nonlin_vars)
00207 {
00208 return false;
00209 }
00211
00212 private:
00222
00223
00225 TNLP(const TNLP&);
00226
00228 void operator=(const TNLP&);
00230 };
00231
00232 }
00233
00234 #endif