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

Go to the documentation of this file.
00001 /* $Id: conv-exprOpp.cpp 490 2011-01-14 16:07:12Z 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-10.
00008  * This file is licensed under the Eclipse Public License (EPL)
00009  */
00010 
00011 #include "CouenneCutGenerator.hpp"
00012 
00013 #include "CouenneTypes.hpp"
00014 #include "CouenneExprOpp.hpp"
00015 #include "CouenneExprConst.hpp"
00016 #include "CouenneExprVar.hpp"
00017 
00018 #include "CouenneProblem.hpp"
00019 
00020 using namespace Couenne;
00021 
00022 // generate equality between *this and *w
00023 void exprOpp::generateCuts (expression *w, //const OsiSolverInterface &si, 
00024                             OsiCuts &cs, const CouenneCutGenerator *cg,
00025                             t_chg_bounds *chg, 
00026                             int wind, CouNumber lb, CouNumber ub) {
00027 
00028   // If wind = -1 then this is the normal procedure (see below,
00029   // "easy..."). Otherwise, there is a constraint of the form -x <= b
00030   // that was translated into auxiliary w = -x and w <= b. wind is w's
00031   // index (which we have to single out)
00032 
00033   if (wind >= 0) {
00034 
00035     int xind = argument_ -> Index ();
00036 
00037     if (xind < 0) {
00038       printf ("#### invalid index for exprOpp::gencuts()\n");
00039       exit (-1);
00040     }
00041 
00042     OsiColCut *cut = new OsiColCut;
00043 
00044     CouNumber 
00045       &xlb = cg -> Problem () -> Lb (xind),
00046       &xub = cg -> Problem () -> Ub (xind);
00047 
00048     if (-ub > xlb) xlb = -ub;
00049     if (-lb < xub) xub = -lb;
00050 
00051     cut -> setLbs (1, &xind, &xlb);
00052     cut -> setUbs (1, &xind, &xub);
00053 
00054     cs.insert (cut);
00055 
00056     delete (cut);
00057   }
00058   else // easy...
00059 
00060     if (cg -> isFirst ()) {
00061 
00062       int wi = w -> Index ();
00063       cg -> createCut (cs, 0., cg -> Problem () -> Var (wi) -> sign (), wi, 1., argument_->Index (), 1.);
00064     }
00065 }

Generated on Thu Nov 10 03:05:43 2011 by  doxygen 1.4.7