11 #include "OsiRowCut.hpp"
12 #include "OsiCuts.hpp"
22 using namespace Couenne;
41 for (lincoeff::iterator el =
lcoeff_.begin (); el !=
lcoeff_.end (); ++el) {
43 std::pair <exprVar *, CouNumber> pairL, pairU;
46 int ind = el -> first ->
Index ();
48 pairL .second = pairU .second = coeff;
58 coeL -> push_back (pairL);
59 coeU -> push_back (pairU);
156 for (lincoeff::iterator el =
lcoeff_.begin (); el !=
lcoeff_.end (); ++el) {
159 CouNumber coeff = el -> second, vlb, vub;
166 if (coeff > 0) inf_lb =
true;
169 if (coeff > 0) lb += vlb * coeff;
170 else ub += vlb * coeff;
174 if (coeff > 0) inf_ub =
true;
177 if (coeff > 0) ub += vub * coeff;
178 else lb += vub * coeff;
202 if (!(cg -> isFirst ()))
208 OsiRowCut *cut =
new OsiRowCut;
224 int displacement = (wind < 0 && !uselessAux) ? 1: 0;
227 int *index =
new int [
nargs_ + nterms + displacement];
229 if (wind < 0 && !uselessAux) {
232 index [0] = w ->
Index ();
243 lincoeff::iterator el =
lcoeff_.begin ();
245 nterms = displacement;
247 for (; el !=
lcoeff_.end (); ++el)
249 if (fabs (el -> second) > 1.e-21) {
252 coeff [nterms] = el -> second;
253 index [nterms++] = el -> first ->
Index ();
257 for (
int i=0; i<
nargs_; i++) {
262 lb -= curr ->
Value ();
263 ub -= curr ->
Value ();
267 index [nterms++] = curr ->
Index ();
271 cut -> setRow (nterms, index, coeff);
279 sign = cg -> Problem () -> Var (w ->
Index ()) -> sign ();
284 cut -> setGloballyValid ();
Cut Generator for linear convexifications.
status of lower/upper bound of a variable, to be checked/modified in bound tightening ...
CouNumber c0_
constant term
exprGroup(CouNumber, lincoeff &, expression **=NULL, int=0)
Constructor.
virtual enum nodeType Type() const
Node type.
virtual int Index() const
Return index of variable (only valid for exprVar and exprAux)
auxSign
"sign" of the constraint defining an auxiliary.
virtual void generateCuts(expression *, OsiCuts &, const CouenneCutGenerator *, t_chg_bounds *=NULL, int=-1, CouNumber=-COUENNE_INFINITY, CouNumber=COUENNE_INFINITY)
special version for linear constraints
lincoeff lcoeff_
coefficients and indices of the linear term
virtual void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
virtual void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
expression ** arglist_
argument list is an array of pointers to other expressions
std::vector< std::pair< exprVar *, CouNumber > > lincoeff
double CouNumber
main number type in Couenne
int nargs_
number of arguments (cardinality of arglist)
void fint fint fint real fint real real real real real real real real * w
These are bound expression classes.
virtual CouNumber Value() const
value (empty)