CouenneInfeasCut.cpp
Go to the documentation of this file.
1 /* $Id: CouenneInfeasCut.cpp 822 2012-02-10 04:45:33Z pbelotti $
2  *
3  * Name: CouenneInfeasCut.cpp
4  * Author: Pietro Belotti
5  * Purpose: An infeasible cut to tell the node solver this node is infeasible -- implementation
6  *
7  * (C) Pietro Belotti, 2010.
8  * This file is licensed under the Eclipse Public License (EPL)
9  */
10 
11 #include "OsiCuts.hpp"
12 
18 
19 void WipeMakeInfeas (OsiCuts &cs) {
20 
21  //for (int i=cs.sizeRowCuts(); i--;) cs. eraseRowCut (i);
22  //for (int i=cs.sizeColCuts(); i--;) cs. eraseColCut (i);
23 
24  OsiColCut *infeascut = new OsiColCut;
25 
26  if (infeascut) {
27  int i=0;
28  double
29  upper = -1.,
30  lower = 1.;
31 
32  infeascut -> setLbs (1, &i, &lower);
33  infeascut -> setUbs (1, &i, &upper);
34 
35  cs.insert (infeascut);
36  delete infeascut;
37  }
38 }
39 
44 
45 bool isWiped (OsiCuts &cs) {
46 
47  if (cs.sizeColCuts () == 0)
48  //(cs.sizeColCuts () != 1))
49  return false;
50 
51  CoinPackedVector
52  lbs = cs.colCutPtr (cs.sizeColCuts () - 1) -> lbs (),
53  ubs = cs.colCutPtr (cs.sizeColCuts () - 1) -> ubs ();
54 
55  return ((lbs.getNumElements () == 1) &&
56  (ubs.getNumElements () == 1) &&
57  (*(lbs.getIndices ()) == 0) &&
58  (*(lbs.getElements ()) == 1.) &&
59  (*(ubs.getIndices ()) == 0) &&
60  (*(ubs.getElements ()) == -1.));
61 }
bool isWiped(OsiCuts &cs)
Check whether the previous cut generators have added an infeasible cut.
void WipeMakeInfeas(OsiCuts &cs)
Add a fictitious cut 1<= x_0 <= -1 as a signal to the node solver that this node is deemed infeasible...