Bonmin
1.8.9
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Interfaces
BonCutStrengthener.hpp
Go to the documentation of this file.
1
// Copyright (C) 2007 International Business Machines and others.
2
// All Rights Reserved.
3
// This code is published under the Eclipse Public License.
4
//
5
// $Id$
6
//
7
// Author: Andreas Waechter IBM 2007-03-29
8
9
#ifndef __BONCUTSTRENGTHENER_HPP__
10
#define __BONCUTSTRENGTHENER_HPP__
11
12
#include "
BonTMINLP.hpp
"
13
#include "
CoinPackedVector.hpp
"
14
#include "
BonTNLPSolver.hpp
"
15
16
namespace
Bonmin
17
{
18
enum
CutStrengtheningType
{
19
CS_None
=0,
20
CS_StrengthenedGlobal
=1,
21
CS_UnstrengthenedGlobal_StrengthenedLocal
=2,
22
CS_StrengthenedGlobal_StrengthenedLocal
=3
23
};
24
25
enum
DisjunctiveCutType
{
26
DC_None
=0,
27
DC_MostFractional
=1
28
};
29
32
class
CutStrengthener
:
public
Ipopt::ReferencedObject
33
{
36
class
StrengtheningTNLP:
public
Ipopt::TNLP
{
37
public
:
39
StrengtheningTNLP(
Ipopt::SmartPtr<TMINLP>
tminlp,
40
const
CoinPackedVector
&
cut
,
41
bool
lower_bound,
42
Ipopt::Index
n,
43
const
Ipopt::Number
* starting_point,
44
const
double
* x_l_orig,
45
const
double
* x_u_orig,
46
Ipopt::Index
constr_index,
47
Ipopt::Index
nvar_constr ,
48
const
Ipopt::Index
* jCol);
49
51
~StrengtheningTNLP();
52
55
56
virtual
bool
get_nlp_info(
Ipopt::Index
& n,
Ipopt::Index
& m,
Ipopt::Index
& nnz_jac_g,
57
Ipopt::Index
& nnz_h_lag,
Ipopt::TNLP::IndexStyleEnum
& index_style);
58
60
virtual
bool
get_bounds_info(
Ipopt::Index
n,
Ipopt::Number
* x_l,
Ipopt::Number
* x_u,
61
Ipopt::Index
m,
Ipopt::Number
* g_l,
Ipopt::Number
* g_u);
62
64
virtual
bool
get_starting_point(
Ipopt::Index
n,
bool
init_x,
Ipopt::Number
* x,
65
bool
init_z,
Ipopt::Number
* z_L,
Ipopt::Number
* z_U,
66
Ipopt::Index
m,
bool
init_lambda,
67
Ipopt::Number
* lambda);
68
70
virtual
bool
eval_f(
Ipopt::Index
n,
const
Ipopt::Number
* x,
bool
new_x,
Ipopt::Number
& obj_value);
71
73
virtual
bool
eval_grad_f(
Ipopt::Index
n,
const
Ipopt::Number
* x,
bool
new_x,
Ipopt::Number
* grad_f);
74
76
virtual
bool
eval_g(
Ipopt::Index
n,
const
Ipopt::Number
* x,
bool
new_x,
Ipopt::Index
m,
Ipopt::Number
* g);
77
82
virtual
bool
eval_jac_g(
Ipopt::Index
n,
const
Ipopt::Number
* x,
bool
new_x,
83
Ipopt::Index
m,
Ipopt::Index
nele_jac,
Ipopt::Index
* iRow,
Ipopt::Index
*jCol,
84
Ipopt::Number
* values);
85
90
virtual
bool
eval_h(
Ipopt::Index
n,
const
Ipopt::Number
* x,
bool
new_x,
91
Ipopt::Number
obj_factor,
Ipopt::Index
m,
const
Ipopt::Number
* lambda,
92
bool
new_lambda,
Ipopt::Index
nele_hess,
Ipopt::Index
* iRow,
93
Ipopt::Index
* jCol,
Ipopt::Number
* values);
94
96
98
99
virtual
void
finalize_solution(
Ipopt::SolverReturn
status,
100
Ipopt::Index
n,
const
Ipopt::Number
* x,
const
Ipopt::Number
* z_L,
const
Ipopt::Number
* z_U,
101
Ipopt::Index
m,
const
Ipopt::Number
* g,
const
Ipopt::Number
* lambda,
102
Ipopt::Number
obj_value,
103
const
Ipopt::IpoptData
* ip_data,
104
Ipopt::IpoptCalculatedQuantities
* ip_cq);
106
108
Ipopt::Number
StrengthenedBound()
const
;
109
110
private
:
113
StrengtheningTNLP();
114
StrengtheningTNLP(
const
StrengtheningTNLP&);
115
StrengtheningTNLP& operator=(
const
StrengtheningTNLP&);
117
120
const
Ipopt::SmartPtr<TMINLP>
tminlp_;
121
123
Ipopt::Number
* obj_grad_;
124
126
const
Ipopt::Index
n_orig_;
127
129
Ipopt::Index
m_orig_;
130
132
Ipopt::Number
* starting_point_;
133
136
Ipopt::Number
* x_full_;
137
139
Ipopt::Number
* x_l_;
140
142
Ipopt::Number
* x_u_;
143
145
const
Ipopt::Index
constr_index_;
146
148
const
Ipopt::Index
nvar_constr_;
149
151
Ipopt::Index
* var_indices_;
152
154
bool
lower_bound_;
155
157
bool
have_final_bound_;
158
160
Ipopt::Number
strengthened_bound_;
161
163
Ipopt::Number
* grad_f_;
164
166
void
update_x_full(
const
Ipopt::Number
*x);
167
};
168
169
public
:
172
174
CutStrengthener
(
Ipopt::SmartPtr<TNLPSolver>
tnlp_solver,
175
Ipopt::SmartPtr<Ipopt::OptionsList>
options);
176
178
virtual
~CutStrengthener
();
180
182
bool
ComputeCuts
(
OsiCuts
&cs,
183
TMINLP
* tminlp,
184
TMINLP2TNLP
* problem,
185
const
int
gindex,
CoinPackedVector
&
cut
,
186
double
& cut_lb,
double
& cut_ub,
187
const
double
g_val,
const
double
g_lb,
188
const
double
g_ub,
189
int
n,
const
double
* x,
190
double
infty);
191
192
private
:
201
202
CutStrengthener
();
203
205
CutStrengthener
(
const
CutStrengthener
&);
206
208
void
operator=(
const
CutStrengthener
&);
210
212
bool
StrengthenCut(
Ipopt::SmartPtr<TMINLP>
tminlp ,
213
int
constr_index ,
214
const
CoinPackedVector
& row ,
215
int
n ,
216
const
double
* x ,
217
const
double
* x_l ,
218
const
double
* x_u ,
219
double
& lb,
220
double
& ub);
221
223
bool
HandleOneCut(
bool
is_tight,
TMINLP
* tminlp,
224
TMINLP2TNLP
* problem,
225
const
double
* minlp_lb,
226
const
double
* minlp_ub,
227
const
int
gindex,
CoinPackedVector
&
cut
,
228
double
& cut_lb,
double
& cut_ub,
229
int
n,
const
double
* x,
230
double
infty);
231
233
Ipopt::SmartPtr<TNLPSolver>
tnlp_solver_;
234
236
int
cut_strengthening_type_;
238
int
disjunctive_cut_type_;
240
int
oa_log_level_;
241
};
242
243
}
// namespace Ipopt
244
#endif
BonTMINLP.hpp
BonTNLPSolver.hpp
CoinPackedVector.hpp
Bonmin::CutStrengthener::CutStrengthener
CutStrengthener(Ipopt::SmartPtr< TNLPSolver > tnlp_solver, Ipopt::SmartPtr< Ipopt::OptionsList > options)
Constructor.
Bonmin::CutStrengthener::~CutStrengthener
virtual ~CutStrengthener()
Destructor.
Bonmin::CutStrengthener::ComputeCuts
bool ComputeCuts(OsiCuts &cs, TMINLP *tminlp, TMINLP2TNLP *problem, const int gindex, CoinPackedVector &cut, double &cut_lb, double &cut_ub, const double g_val, const double g_lb, const double g_ub, int n, const double *x, double infty)
Method for generating and strenghtening all desired cuts.
Bonmin::TMINLP2TNLP
This is an adapter class that converts a TMINLP to a TNLP to be solved by Ipopt.
Definition
BonTMINLP2TNLP.hpp:33
Bonmin::TMINLP
Base class for all MINLPs that use a standard triplet matrix form and dense vectors.
Definition
BonTMINLP.hpp:60
CoinPackedVector
Ipopt::IpoptCalculatedQuantities
Ipopt::IpoptData
Ipopt::ReferencedObject
Ipopt::SmartPtr
Ipopt::TNLP
Ipopt::TNLP::IndexStyleEnum
IndexStyleEnum
OsiCuts
Bonmin
(C) Copyright International Business Machines Corporation 2007
Definition
BonAmplSetup.hpp:16
Bonmin::CutStrengtheningType
CutStrengtheningType
Definition
BonCutStrengthener.hpp:18
Bonmin::CS_StrengthenedGlobal_StrengthenedLocal
@ CS_StrengthenedGlobal_StrengthenedLocal
Definition
BonCutStrengthener.hpp:22
Bonmin::CS_UnstrengthenedGlobal_StrengthenedLocal
@ CS_UnstrengthenedGlobal_StrengthenedLocal
Definition
BonCutStrengthener.hpp:21
Bonmin::CS_StrengthenedGlobal
@ CS_StrengthenedGlobal
Definition
BonCutStrengthener.hpp:20
Bonmin::CS_None
@ CS_None
Definition
BonCutStrengthener.hpp:19
Bonmin::DisjunctiveCutType
DisjunctiveCutType
Definition
BonCutStrengthener.hpp:25
Bonmin::DC_None
@ DC_None
Definition
BonCutStrengthener.hpp:26
Bonmin::DC_MostFractional
@ DC_MostFractional
Definition
BonCutStrengthener.hpp:27
Ipopt::SolverReturn
SolverReturn
Ipopt::Index
ipindex Index
Ipopt::Number
ipnumber Number
cut
Generated by
1.17.0