Debian Codegraph @

Bonmin/experimental/Separable/SepaTMINLP2OsiLP.hpp

raw
1 // (C) Copyright International Business Machines Corporation 2007
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors :
6 // Pierre Bonami, International Business Machines Corporation
7 //
8 // Date : 10/16/2007
9 #ifndef SepaSepaTMINLP2OsiLP_H
10 #define SepaSepaTMINLP2OsiLP_H
11
12 #include <cmath>
13 #include <cstdio>
14 #include "IpSmartPtr.hpp"
15 #include "IpTNLP.hpp"
16 #include "BonTypes.hpp"
17 #include "BonTMINLP2OsiLP.hpp"
18
19
20 namespace Sepa {
21
22 /** A transformer class to build outer approximations i.e. transfomrs nonlinear programs into linear programs.*/
23 class SepaTMINLP2OsiLP: public Bonmin::TMINLP2OsiLP {
24
25 public:
26
27 /** Default constructor.*/
28 SepaTMINLP2OsiLP():
29 TMINLP2OsiLP(),
30 num_approx_(0)
31 {}
32
33 /** Copy constructor.*/
34 SepaTMINLP2OsiLP(const SepaTMINLP2OsiLP & other):
35 TMINLP2OsiLP(other),
36 num_approx_(other.num_approx_){
37 }
38
39 TMINLP2OsiLP * clone() const{
40 return new SepaTMINLP2OsiLP(*this);
41 }
42
43 /** Assignment operator.*/
44 SepaTMINLP2OsiLP & operator=(const SepaTMINLP2OsiLP& rhs){
45 if(this != & rhs){
46 TMINLP2OsiLP::operator=(rhs);
47 num_approx_ = rhs.num_approx_;
48 }
49 return (*this);
50 }
51
52 void set_num_approx(int v){
53 num_approx_ = v;
54 }
55
56 /** Destructor.*/
57 ~SepaTMINLP2OsiLP(){}
58
59 /** Build the Outer approximation of model_ in x and put it in si.*/
60 virtual void extract(OsiSolverInterface *si,
61 const double * x, bool getObj) ;
62
63 /** Get OAs of nonlinear constraints in x.*/
64 virtual void get_oas(OsiCuts & cs,
65 const double * x, bool getObj, bool global) const;
66
67 virtual void get_refined_oa(OsiCuts & cs) const;
68 /** Get OA of one constraints in x.*/
69 virtual void get_oa(int iRow, OsiCuts & cs,
70 const double * x, bool getObj, bool global) const;
71
72 void add_outer_description(OsiSolverInterface &si) ;
73 void add_outer_description_function_values(OsiSolverInterface &si) ;
74 private:
75 int num_approx_;
76 };
77
78
79 }
80
81 #endif
82