/home/coin/SVN-release/OS-2.1.0/Couenne/src/convex/operators/conv-exprSub.cpp

Go to the documentation of this file.
00001 /* $Id: conv-exprSub.cpp 217 2009-07-08 17:02:07Z pbelotti $
00002  *
00003  * Name:    exprSub.cpp
00004  * Author:  Pietro Belotti
00005  * Purpose: convexification methods for the Subtraction class
00006  *
00007  * (C) Carnegie-Mellon University, 2006-09.
00008  * This file is licensed under the Common Public License (CPL)
00009  */
00010 
00011 #include "CouenneTypes.hpp"
00012 #include "CouenneCutGenerator.hpp"
00013 #include "exprSub.hpp"
00014 #include "exprOpp.hpp"
00015 
00016 // generate equality between *this and *w
00017 void exprSub::generateCuts (expression *w, //const OsiSolverInterface &si, 
00018                             OsiCuts &cs, const CouenneCutGenerator *cg,
00019                             t_chg_bounds *chg, 
00020                             int wind, CouNumber lb, CouNumber ub) {
00021 
00022   if (!(cg -> isFirst ()))
00023     return;
00024 
00025   // only add one cut at the beginning
00026 
00027   expression *x = arglist_ [0];
00028   expression *y = arglist_ [1];
00029 
00030   int wi = w -> Index ();
00031   int xi = x -> Index ();
00032   int yi = y -> Index ();
00033 
00034   if (wind >= 0) wi = -1; // do not insert w's index if specified as input
00035   else lb = ub = 0;
00036 
00037   if (xi < 0) {
00038     CouNumber x0 = x -> Value ();
00039     lb -= x0;
00040     ub -= x0;
00041   }
00042 
00043   if (yi < 0) {
00044     CouNumber y0 = y -> Value ();
00045     lb += y0;
00046     ub += y0;
00047   }
00048 
00049   cg -> createCut (cs, lb, ub, wi, -1., xi, 1., yi, -1., true);
00050 }

Generated on Tue Mar 30 03:04:37 2010 by  doxygen 1.4.7