00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __SMAGMINLP_HPP__
00010 #define __SMAGMINLP_HPP__
00011
00012 #include "GAMSlinksConfig.h"
00013
00014 #include "BonTMINLP.hpp"
00015
00016
00017
00018 #ifdef HAVE_CSTDIO
00019 #include <cstdio>
00020 #endif
00021 #ifdef HAVE_CSTDARG
00022 #include <cstdarg>
00023 #endif
00024 #include "smag.h"
00025
00026 using namespace Ipopt;
00027 using namespace Bonmin;
00028
00031 class SMAG_MINLP : public TMINLP {
00032 public:
00036 SMAG_MINLP (smagHandle_t prob);
00037
00039 virtual ~SMAG_MINLP();
00040
00042 virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00043 Index& nnz_h_lag, TNLP::IndexStyleEnum& index_style);
00044
00046 virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00047 Index m, Number* g_l, Number* g_u);
00048
00053 virtual bool get_variables_types(Index n, VariableType* var_types);
00054
00059 virtual bool get_variables_linearity(Index n, Ipopt::TNLP::LinearityType* var_linearity);
00060
00065 virtual bool get_constraints_linearity(Index m, Ipopt::TNLP::LinearityType* const_types);
00066
00067
00069 virtual bool get_starting_point(Index n, bool init_x, Number* x,
00070 bool init_z, Number* z_L, Number* z_U,
00071 Index m, bool init_lambda,
00072 Number* lambda);
00073
00074 virtual bool get_scaling_parameters(Number &obj_scaling,
00075 bool &use_x_scaling, Index n, Number *x_scaling,
00076 bool &use_g_scaling, Index m, Number *g_scaling);
00077
00079 virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
00080
00082 virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
00083
00085 virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
00086
00091 virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00092 Index m, Index nele_jac, Index* iRow, Index *jCol,
00093 Number* values);
00094
00102 virtual bool eval_gi(Index n, const Number* x, bool new_x, Index i, Number& gi);
00103
00114 virtual bool eval_grad_gi(Index n, const Number* x, bool new_x,
00115 Index i, Index& nele_grad_gi, Index* jCol, Number* values);
00116
00121 virtual bool eval_h(Index n, const Number* x, bool new_x,
00122 Number obj_factor, Index m, const Number* lambda,
00123 bool new_lambda, Index nele_hess, Index* iRow,
00124 Index* jCol, Number* values);
00125
00126 virtual void finalize_solution(TMINLP::SolverReturn status,Index n, const Number* x, Number obj_value);
00127
00130 virtual const SosInfo* sosConstraints() const;
00131
00134 virtual const BranchingInfo* branchingInfo() const;
00135
00136 double div_iter_tol;
00137 long int domviolations;
00138 double clock_start;
00139 int model_status, solver_status;
00140 private:
00141 smagHandle_t prob;
00142 double *negLambda;
00143 double isMin;
00144
00145
00146 SosInfo sosinfo;
00147 BranchingInfo branchinginfo;
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 SMAG_MINLP();
00159 SMAG_MINLP(const SMAG_MINLP&);
00160 SMAG_MINLP& operator=(const SMAG_MINLP&);
00161
00164 void setupPrioritiesSOS();
00165 };
00166
00167
00168 #endif