00001
00002
00003
00004
00005
00006
00007
00008
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
00023 void exprOpp::generateCuts (expression *w,
00024 OsiCuts &cs, const CouenneCutGenerator *cg,
00025 t_chg_bounds *chg,
00026 int wind, CouNumber lb, CouNumber ub) {
00027
00028
00029
00030
00031
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
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 }