00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "CouenneCutGenerator.hpp"
00012 #include "CouenneProblem.hpp"
00013 #include "CouenneObject.hpp"
00014 #include "CouenneExprAux.hpp"
00015 #include "CouenneExprVar.hpp"
00016 #include "CouenneExprBound.hpp"
00017 #include "CouenneDepGraph.hpp"
00018
00019 using namespace Couenne;
00020
00021
00022 void exprVar::getBounds (expression *&lb, expression *&ub) {
00023
00024 lb = new exprLowerBound (varIndex_, domain_);
00025 ub = new exprUpperBound (varIndex_, domain_);
00026 }
00027
00028
00029
00030 void exprVar::getBounds (CouNumber &lb, CouNumber &ub) {
00031
00032 lb = domain_ -> lb (varIndex_);
00033 ub = domain_ -> ub (varIndex_);
00034 }
00035
00036
00037
00038 void exprVar::generateCuts (expression *w,
00039 OsiCuts &cs, const CouenneCutGenerator *cg,
00040 t_chg_bounds *chg, int,
00041 CouNumber, CouNumber) {
00042 if (cg -> isFirst ())
00043 cg -> createCut (cs, 0., cg -> Problem () -> Var (w -> Index ()) -> sign (), w -> Index (), 1., varIndex_, -1);
00044 }
00045
00046
00049 bool exprVar::impliedBound (int wind, CouNumber *l, CouNumber *u, t_chg_bounds *chg, enum auxSign sign) {
00050
00051 bool res = false;
00052
00053 if (updateBound (-1, l + varIndex_, sign == expression::AUX_GEQ ? -COIN_DBL_MAX : l [wind])) {res = true; chg [varIndex_].setLower(t_chg_bounds::CHANGED);}
00054 if (updateBound (+1, u + varIndex_, sign == expression::AUX_LEQ ? COIN_DBL_MAX : u [wind])) {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 (CouenneCutGenerator *c,
00072 CouenneProblem *p,
00073 Bonmin::BabSetupBase *base,
00074 JnlstPtr jnlst_) {
00075 return new CouenneObject ();
00076 }