00001
00002
00003
00004
00005
00006
00007
00008
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
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
00026
00027
00028
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
00056 if (cg -> isFirst ())
00057 cg -> createCut (cs, 0., 0, w->Index (), 1., argument_->Index (), 1.);
00058 }