/home/coin/SVN-release/OS-2.4.0/Couenne/src/bound_tightening/CouenneInfeasCut.cpp

Go to the documentation of this file.
00001 /* $Id: CouenneInfeasCut.cpp 490 2011-01-14 16:07:12Z pbelotti $
00002  *
00003  * Name:    CouenneInfeasCut.cpp
00004  * Author:  Pietro Belotti
00005  * Purpose: An infeasible cut to tell the node solver this node is infeasible -- implementation
00006  *
00007  * (C) Pietro Belotti, 2010.
00008  * This file is licensed under the Eclipse Public License (EPL)
00009  */
00010 
00011 #include "OsiCuts.hpp"
00012 
00018 
00019 void WipeMakeInfeas (OsiCuts &cs) {
00020 
00021   //for (int i=cs.sizeRowCuts(); i--;) cs. eraseRowCut (i);
00022   //for (int i=cs.sizeColCuts(); i--;) cs. eraseColCut (i);
00023 
00024   OsiColCut *infeascut = new OsiColCut;
00025 
00026   if (infeascut) {
00027     int i=0;
00028     double upper = -1., lower = +1.;
00029     infeascut -> setLbs (1, &i, &lower);
00030     infeascut -> setUbs (1, &i, &upper);
00031     cs.insert (infeascut);
00032     delete infeascut;
00033   }
00034 }
00035 
00040 
00041 bool isWiped (OsiCuts &cs) {
00042 
00043   if (cs.sizeColCuts () == 0)
00044   //(cs.sizeColCuts () != 1))
00045     return false;
00046 
00047   CoinPackedVector 
00048     lbs = cs.colCutPtr (cs.sizeColCuts () - 1) -> lbs (),
00049     ubs = cs.colCutPtr (cs.sizeColCuts () - 1) -> ubs ();
00050 
00051   return ((lbs.getNumElements ()  == 1)  &&
00052           (ubs.getNumElements ()  == 1)  &&
00053           (*(lbs.getIndices   ()) == 0)  &&
00054           (*(lbs.getElements  ()) == 1.) &&
00055           (*(ubs.getIndices   ()) == 0)  &&
00056           (*(ubs.getElements  ()) == -1.));
00057 }

Generated on Thu Sep 22 03:05:55 2011 by  doxygen 1.4.7