00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "CouenneComplObject.hpp"
00012 #include "CouenneComplBranchingObject.hpp"
00013
00014
00016 CouenneComplObject::CouenneComplObject (CouenneProblem *p,
00017 exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst):
00018 CouenneObject (p, ref, base, jnlst) {
00019 jnlst -> Printf (J_DETAILED, J_PROBLEM, "[created Complementarity constraint object]\n");
00020 }
00021
00022
00024 CouenneComplObject::CouenneComplObject (exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst):
00025 CouenneObject (ref, base, jnlst) {}
00026
00027
00029 CouenneComplObject::CouenneComplObject (const CouenneObject &src):
00030 CouenneObject (src) {}
00031
00032
00035 double CouenneComplObject::infeasibility (const OsiBranchingInformation *info, int &way) const {
00036
00037 expression **arglist = reference_ -> Image () -> ArgList ();
00038
00039 int index0 = arglist [0] -> Index (),
00040 index1 = arglist [1] -> Index ();
00041
00042 CouNumber
00043 x0 = fabs (info -> solution_ [index0]),
00044 x1 = fabs (info -> solution_ [index1]);
00045
00046
00047
00048 way = (x1 < x0) ? 1 : 0;
00049
00050 return x0 * x1;
00051 }
00052
00053
00056 double CouenneComplObject::checkInfeasibility (const OsiBranchingInformation * info) const {
00057
00058 expression **arglist = reference_ -> Image () -> ArgList ();
00059
00060 int index0 = arglist [0] -> Index (),
00061 index1 = arglist [1] -> Index ();
00062
00063 return
00064 fabs (info -> solution_ [index0]) *
00065 fabs (info -> solution_ [index1]);
00066 }
00067
00068
00071 OsiBranchingObject *CouenneComplObject::createBranch (OsiSolverInterface *solver,
00072 const OsiBranchingInformation *info,
00073 int way) const {
00074
00075 expression **args = reference_ -> Image () -> ArgList ();
00076
00077
00078
00079
00080
00081 return new CouenneComplBranchingObject (solver, this, jnlst_,
00082 args [0],
00083 args [1],
00084 way, 0, doFBBT_, doConvCuts_);
00085 }