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

Go to the documentation of this file.
00001 /* $Id: conv-exprOpp.cpp 217 2009-07-08 17:02:07Z pbelotti $
00002  *
00003  * Name:    conv-exprOpp.cpp
00004  * Author:  Pietro Belotti
00005  * Purpose: methods to convexify opposite of expressions
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 "exprOpp.hpp"
00013 #include "exprConst.hpp"
00014 
00015 #include "CouenneProblem.hpp"
00016 #include "CouenneCutGenerator.hpp"
00017 
00018 
00019 // generate equality between *this and *w
00020 void exprOpp::generateCuts (expression *w, //const OsiSolverInterface &si, 
00021                             OsiCuts &cs, const CouenneCutGenerator *cg,
00022                             t_chg_bounds *chg, 
00023                             int wind, CouNumber lb, CouNumber ub) {
00024 
00025   // If wind = -1 then this is the normal procedure (see below,
00026   // "easy..."). Otherwise, there is a constraint of the form -x <= b
00027   // that was translated into auxiliary w = -x and w <= b. wind is w's
00028   // index (which we have to single out)
00029 
00030   if (wind >= 0) {
00031 
00032     int xind = argument_ -> Index ();
00033 
00034     if (xind < 0) {
00035       printf ("#### invalid index for exprOpp::gencuts()\n");
00036       return;
00037     }
00038 
00039     OsiColCut *cut = new OsiColCut;
00040 
00041     CouNumber 
00042       &xlb = cg -> Problem () -> Lb (xind),
00043       &xub = cg -> Problem () -> Ub (xind);
00044 
00045     if (-ub > xlb) xlb = -ub;
00046     if (-lb < xub) xub = -lb;
00047 
00048     cut -> setLbs (1, &xind, &xlb);
00049     cut -> setUbs (1, &xind, &xub);
00050 
00051     cs.insert (cut);
00052 
00053     delete (cut);
00054   }
00055   else // easy... 
00056     if (cg -> isFirst ())
00057       cg -> createCut (cs, 0., 0, w->Index (), 1., argument_->Index (), 1.);
00058 }

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