GAMSlinks  0.4
SmagMINLP.hpp
Go to the documentation of this file.
1 // Copyright (C) GAMS Development 2007
2 // All Rights Reserved.
3 // This code is published under the Common Public License.
4 //
5 // $Id: SmagMINLP.hpp 510 2008-08-16 19:31:27Z stefan $
6 //
7 // Authors: Steve Dirkse, Stefan Vigerske
8 
9 #ifndef __SMAGMINLP_HPP__
10 #define __SMAGMINLP_HPP__
11 
12 #include "GAMSlinksConfig.h"
13 
14 #include "BonTMINLP.hpp"
15 
16 // smag.h will try to include stdio.h and stdarg.h
17 // so we include cstdio and cstdarg before if we know that we have them
18 #ifdef HAVE_CSTDIO
19 #include <cstdio>
20 #endif
21 #ifdef HAVE_CSTDARG
22 #include <cstdarg>
23 #endif
24 #include "smag.h"
25 
26 using namespace Ipopt;
27 using namespace Bonmin;
28 
31 class SMAG_MINLP : public TMINLP {
32 public:
36  SMAG_MINLP (smagHandle_t prob);
37 
39  virtual ~SMAG_MINLP();
40 
42  virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
43  Index& nnz_h_lag, TNLP::IndexStyleEnum& index_style);
44 
46  virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
47  Index m, Number* g_l, Number* g_u);
48 
53  virtual bool get_variables_types(Index n, VariableType* var_types);
54 
59  virtual bool get_variables_linearity(Index n, Ipopt::TNLP::LinearityType* var_linearity);
60 
65  virtual bool get_constraints_linearity(Index m, Ipopt::TNLP::LinearityType* const_types);
66 
67 
69  virtual bool get_starting_point(Index n, bool init_x, Number* x,
70  bool init_z, Number* z_L, Number* z_U,
71  Index m, bool init_lambda,
72  Number* lambda);
73 
74  virtual bool get_scaling_parameters(Number &obj_scaling,
75  bool &use_x_scaling, Index n, Number *x_scaling,
76  bool &use_g_scaling, Index m, Number *g_scaling);
77 
79  virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
80 
82  virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
83 
85  virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
86 
91  virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
92  Index m, Index nele_jac, Index* iRow, Index *jCol,
93  Number* values);
94 
102  virtual bool eval_gi(Index n, const Number* x, bool new_x, Index i, Number& gi);
103 
114  virtual bool eval_grad_gi(Index n, const Number* x, bool new_x,
115  Index i, Index& nele_grad_gi, Index* jCol, Number* values);
116 
121  virtual bool eval_h(Index n, const Number* x, bool new_x,
122  Number obj_factor, Index m, const Number* lambda,
123  bool new_lambda, Index nele_hess, Index* iRow,
124  Index* jCol, Number* values);
125 
126  virtual void finalize_solution(TMINLP::SolverReturn status,Index n, const Number* x, Number obj_value);
127 
130  virtual const SosInfo* sosConstraints() const;
131 
134  virtual const BranchingInfo* branchingInfo() const;
135 
136  double div_iter_tol;
137  long int domviolations;
138  double clock_start; // time when solving starts
139  int model_status, solver_status;
140 private:
141  smagHandle_t prob;
142  double *negLambda;
143  double isMin;
144 // long int domviollimit;
145 
146  SosInfo sosinfo;
147  BranchingInfo branchinginfo;
148 
149  /* Methods to block default compiler methods.
150  * The compiler automatically generates the following three methods.
151  * Since the default compiler implementation is generally not what
152  * you want (for all but the most simple classes), we usually
153  * put the declarations of these methods in the private section
154  * and never implement them. This prevents the compiler from
155  * implementing an incorrect "default" behavior without us
156  * knowing. (See Scott Meyers book, "Effective C++")
157  */
158  SMAG_MINLP();
159  SMAG_MINLP(const SMAG_MINLP&);
160  SMAG_MINLP& operator=(const SMAG_MINLP&);
161 
164  void setupPrioritiesSOS();
165 };
166 
167 
168 #endif /* ifndef __SMAGMINLP_HPP__ */
int solver_status
Definition: SmagMINLP.hpp:139
double clock_start
Definition: SmagMINLP.hpp:138
double isMin
Definition: SmagMINLP.hpp:143
SosInfo sosinfo
Definition: SmagMINLP.hpp:146
long int domviolations
Definition: SmagMINLP.hpp:137
double div_iter_tol
Definition: SmagMINLP.hpp:136
smagHandle_t prob
Definition: SmagMINLP.hpp:141
double * negLambda
Definition: SmagMINLP.hpp:142
BranchingInfo branchinginfo
Definition: SmagMINLP.hpp:147
A TNLP for Ipopt that uses SMAG to interface the problem formulation.
Definition: SmagMINLP.hpp:31