00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "CouenneCutGenerator.hpp"
00012 #include "CouenneObject.hpp"
00013 #include "exprAux.hpp"
00014 #include "exprVar.hpp"
00015 #include "exprBound.hpp"
00016 #include "depGraph.hpp"
00017
00018
00019
00020 void exprVar::getBounds (expression *&lb, expression *&ub) {
00021
00022 lb = new exprLowerBound (varIndex_, domain_);
00023 ub = new exprUpperBound (varIndex_, domain_);
00024 }
00025
00026
00027
00028 void exprVar::getBounds (CouNumber &lb, CouNumber &ub) {
00029
00030 lb = domain_ -> lb (varIndex_);
00031 ub = domain_ -> ub (varIndex_);
00032 }
00033
00034
00035
00036 void exprVar::generateCuts (expression *w, const OsiSolverInterface &si,
00037 OsiCuts &cs, const CouenneCutGenerator *cg,
00038 t_chg_bounds *chg, int,
00039 CouNumber, CouNumber) {
00040 if (cg -> isFirst ())
00041 cg -> createCut (cs, 0., 0, w -> Index (), 1., varIndex_, -1);
00042 }
00043
00044
00047 bool exprVar::impliedBound (int wind, CouNumber *l, CouNumber *u, t_chg_bounds *chg) {
00048
00049 bool res = false;
00050
00051 if (updateBound (-1, l + varIndex_, l [wind]))
00052 {res = true; chg [varIndex_].setLower(t_chg_bounds::CHANGED);}
00053 if (updateBound (+1, u + varIndex_, u [wind]))
00054 {res = true; chg [varIndex_].setUpper(t_chg_bounds::CHANGED);}
00055
00056 return res;
00057 }
00058
00059
00061 void exprVar::fillDepSet (std::set <DepNode *, compNode> *dep, DepGraph *g)
00062 {dep -> insert (g -> lookup (varIndex_));}
00063
00064
00065 expression *exprVar::Lb () {return new exprLowerBound (varIndex_, domain_);}
00066 expression *exprVar::Ub () {return new exprUpperBound (varIndex_, domain_);}
00067
00068
00069
00070
00071 CouenneObject exprVar::properObject (CouenneProblem *p,
00072 Bonmin::BabSetupBase *base,
00073 JnlstPtr jnlst_) {
00074 return CouenneObject ();
00075 }