Osi
0.108.12
Toggle main menu visibility
Loading...
Searching...
No Matches
Osi
src
Osi
OsiCut.hpp
Go to the documentation of this file.
1
// Copyright (C) 2000, International Business Machines
2
// Corporation and others. All Rights Reserved.
3
// This code is licensed under the terms of the Eclipse Public License (EPL).
4
5
#ifndef OsiCut_H
6
#define OsiCut_H
7
8
#include "
OsiCollections.hpp
"
9
#include "
OsiSolverInterface.hpp
"
10
18
19
/*
20
COIN_NOTEST_DUPLICATE is rooted in CoinUtils. Check there before you
21
meddle here.
22
*/
23
#ifdef COIN_FAST_CODE
24
#ifndef COIN_NOTEST_DUPLICATE
25
#define COIN_NOTEST_DUPLICATE
26
#endif
27
#endif
28
29
#ifndef COIN_NOTEST_DUPLICATE
30
#define COIN_DEFAULT_VALUE_FOR_DUPLICATE true
31
#else
32
#define COIN_DEFAULT_VALUE_FOR_DUPLICATE false
33
#endif
34
35
class
OsiCut
{
36
37
public
:
38
//-------------------------------------------------------------------
41
42
inline
void
setEffectiveness
(
double
e);
44
inline
double
effectiveness
()
const
;
46
49
50
inline
void
setGloballyValid
(
bool
trueFalse)
51
{
52
globallyValid_
= trueFalse ? 1 : 0;
53
}
54
inline
void
setGloballyValid
()
55
{
56
globallyValid_
= 1;
57
}
58
inline
void
setNotGloballyValid
()
59
{
60
globallyValid_
= 0;
61
}
62
63
inline
bool
globallyValid
()
const
64
{
65
return
globallyValid_
!= 0;
66
}
67
68
inline
void
setGloballyValidAsInteger
(
int
trueFalse)
69
{
70
globallyValid_
= trueFalse;
71
}
72
73
inline
int
globallyValidAsInteger
()
const
74
{
75
return
globallyValid_
;
76
}
77
78
81
82
virtual
void
print
()
const
{}
84
85
#if 0
86
/ **@name Times used */
87
/ /@{
88
/
// Set times used
89
inline
void
setTimesUsed(
int
t );
90
/
// Increment times used
91
inline
void
incrementTimesUsed();
92
/
// Get times used
93
inline
int
timesUsed()
const
;
94
/ /@}
95
96
/ **@name Times tested */
97
/ /@{
98
/
// Set times tested
99
inline
void
setTimesTested(
int
t );
100
/
// Increment times tested
101
inline
void
incrementTimesTested();
102
/
// Get times tested
103
inline
int
timesTested()
const
;
104
/ /@}
105
#endif
106
107
//----------------------------------------------------------------
108
111
112
inline
virtual
bool
operator==
(
const
OsiCut
&rhs)
const
;
114
inline
virtual
bool
operator!=
(
const
OsiCut
&rhs)
const
;
116
inline
virtual
bool
operator<
(
const
OsiCut
&rhs)
const
;
118
inline
virtual
bool
operator>
(
const
OsiCut
&rhs)
const
;
120
121
//----------------------------------------------------------------
122
// consistent() - returns true if the cut is consistent with repect to itself.
123
// This might include checks to ensure that a packed vector
124
// itself does not have a negative index.
125
// consistent(const OsiSolverInterface& si) - returns true if cut is consistent with
126
// respect to the solver interface's model. This might include a check to
127
// make sure a column index is not greater than the number
128
// of columns in the problem.
129
// infeasible(const OsiSolverInterface& si) - returns true if the cut is infeasible
130
// "with respect to itself". This might include a check to ensure
131
// the lower bound is greater than the upper bound, or if the
132
// cut simply replaces bounds that the new bounds are feasible with
133
// respect to the old bounds.
134
//-----------------------------------------------------------------
137
142
inline
virtual
bool
consistent
()
const
= 0;
143
149
inline
virtual
bool
consistent
(
const
OsiSolverInterface
&si)
const
= 0;
150
172
inline
virtual
bool
infeasible
(
const
OsiSolverInterface
&si)
const
= 0;
173
178
virtual
double
violated
(
const
double
*solution)
const
= 0;
180
181
protected
:
184
185
OsiCut
();
186
188
OsiCut
(
const
OsiCut
&);
189
191
OsiCut
&
operator=
(
const
OsiCut
&rhs);
192
194
virtual
~OsiCut
();
196
197
private
:
200
201
double
effectiveness_
;
203
int
globallyValid_
;
204
#if 0
206
int
timesUsed_;
208
int
timesTested_;
209
#endif
211
};
212
213
//-------------------------------------------------------------------
214
// Set/Get member data
215
//-------------------------------------------------------------------
216
void
OsiCut::setEffectiveness
(
double
e) {
effectiveness_
= e; }
217
double
OsiCut::effectiveness
()
const
{
return
effectiveness_
; }
218
219
#if 0
220
void
OsiCut::setTimesUsed(
int
t ) { timesUsed_=t; }
221
void
OsiCut::incrementTimesUsed() { timesUsed_++; }
222
int
OsiCut::timesUsed()
const
{
return
timesUsed_; }
223
224
void
OsiCut::setTimesTested(
int
t ) { timesTested_=t; }
225
void
OsiCut::incrementTimesTested() { timesTested_++; }
226
int
OsiCut::timesTested()
const
{
return
timesTested_; }
227
#endif
228
229
//----------------------------------------------------------------
230
// == operator
231
//-------------------------------------------------------------------
232
bool
OsiCut::operator==
(
const
OsiCut
&rhs)
const
233
{
234
return
effectiveness
() == rhs.
effectiveness
();
235
}
236
bool
OsiCut::operator!=
(
const
OsiCut
&rhs)
const
237
{
238
return
!((*this) == rhs);
239
}
240
bool
OsiCut::operator<
(
const
OsiCut
&rhs)
const
241
{
242
return
effectiveness
() < rhs.
effectiveness
();
243
}
244
bool
OsiCut::operator>
(
const
OsiCut
&rhs)
const
245
{
246
return
effectiveness
() > rhs.
effectiveness
();
247
}
248
#endif
249
250
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
251
*/
OsiCollections.hpp
OsiSolverInterface.hpp
OsiCut::OsiCut
OsiCut(const OsiCut &)
Copy constructor.
OsiCut::operator=
OsiCut & operator=(const OsiCut &rhs)
Assignment operator.
OsiCut::operator==
virtual bool operator==(const OsiCut &rhs) const
equal. 2 cuts are equal if there effectiveness are equal
Definition
OsiCut.hpp:232
OsiCut::globallyValid_
int globallyValid_
If cut has global validity i.e. can be used anywhere in tree.
Definition
OsiCut.hpp:203
OsiCut::infeasible
virtual bool infeasible(const OsiSolverInterface &si) const =0
Returns true if the cut is infeasible "with respect to itself" and cannot be satisfied.
OsiCut::operator>
virtual bool operator>(const OsiCut &rhs) const
less than. True if this.effectiveness > rhs.effectiveness
Definition
OsiCut.hpp:244
OsiCut::violated
virtual double violated(const double *solution) const =0
Returns infeasibility of the cut with respect to solution passed in i.e.
OsiCut::consistent
virtual bool consistent() const =0
Returns true if the cut is consistent with respect to itself, without considering any data in the mod...
OsiCut::operator<
virtual bool operator<(const OsiCut &rhs) const
less than. True if this.effectiveness < rhs.effectiveness
Definition
OsiCut.hpp:240
OsiCut::~OsiCut
virtual ~OsiCut()
Destructor.
OsiCut::setNotGloballyValid
void setNotGloballyValid()
Definition
OsiCut.hpp:58
OsiCut::globallyValidAsInteger
int globallyValidAsInteger() const
Get globallyValid.
Definition
OsiCut.hpp:73
OsiCut::setEffectiveness
void setEffectiveness(double e)
Set effectiveness.
Definition
OsiCut.hpp:216
OsiCut::setGloballyValid
void setGloballyValid()
Definition
OsiCut.hpp:54
OsiCut::effectiveness_
double effectiveness_
Effectiveness.
Definition
OsiCut.hpp:201
OsiCut::effectiveness
double effectiveness() const
Get effectiveness.
Definition
OsiCut.hpp:217
OsiCut::setGloballyValid
void setGloballyValid(bool trueFalse)
Set globallyValid (nonzero true).
Definition
OsiCut.hpp:50
OsiCut::print
virtual void print() const
Print cuts in collection.
Definition
OsiCut.hpp:82
OsiCut::OsiCut
OsiCut()
Default Constructor.
OsiCut::setGloballyValidAsInteger
void setGloballyValidAsInteger(int trueFalse)
Set globallyValid as integer (nonzero true).
Definition
OsiCut.hpp:68
OsiCut::globallyValid
bool globallyValid() const
Get globallyValid.
Definition
OsiCut.hpp:63
OsiCut::operator!=
virtual bool operator!=(const OsiCut &rhs) const
not equal
Definition
OsiCut.hpp:236
OsiCut::consistent
virtual bool consistent(const OsiSolverInterface &si) const =0
Returns true if cut is consistent when considering the solver interface's model.
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition
OsiSolverInterface.hpp:61
Generated by
1.17.0