11 #include "CoinHelperFunctions.hpp"
16 using namespace Ipopt;
17 using namespace Couenne;
29 double CouenneVarObject::infeasibility (
const OsiBranchingInformation *
info,
int &way)
const {
32 int index = reference_ -> Index ();
45 problem_ -> domain () -> push
46 (problem_ -> nVars (),
54 CouNumber retval = checkInfeasibility (info);
59 (jnlst_ -> ProduceOutput (J_DETAILED,
J_BRANCHING))) {
61 const std::set <int> &dependence = problem_ -> Dependence () [index];
63 printf (
"infeasVar x%d %-10g [", reference_ -> Index (), retval);
64 reference_ -> print ();
65 if ((dependence.size () == 0) && (reference_ -> Image ())) {
67 reference_ -> Image () -> print ();
80 CouNumber brkPt = computeBranchingPoint (info, way, obj_ignored);
82 if (fabs (brkPt) > 1e27)
88 if (pseudoMultType_ != PROJECTDIST)
89 setEstimates (info, &retval, &brkPt);
91 if (jnlst_ -> ProduceOutput (J_DETAILED,
J_BRANCHING)) {
92 printf(
"index = %d up = %e down = %e bounds [%e,%e] brpt = %e inf = %e\n",
93 index, upEstimate_, downEstimate_,
94 info -> lower_ [index],
95 info -> upper_ [index], brkPt, retval);
98 if (retval <= CoinMin (
COUENNE_EPS, feas_tolerance_))
102 problem_ -> domain () -> pop ();
104 int refInd = reference_ -> Index ();
107 CouNumber intinfeas = intInfeasibility (info -> solution_ [refInd],
108 info -> lower_ [refInd],
109 info -> upper_ [refInd]);
110 if ((intinfeas > retval) &&
111 (intinfeas > info -> integerTolerance_))
120 "infVar x%d ==> returning %e\n", reference_ -> Index (), (reference_ ->
isInteger ()) ?
121 CoinMax (retval, intInfeasibility (info -> solution_ [refInd],
122 info -> lower_ [refInd],
123 info -> upper_ [refInd])) :
136 double CouenneVarObject::checkInfeasibility (
const OsiBranchingInformation *
info)
const {
138 int indexVar = reference_ -> Index ();
140 const std::set <int> &dependence = problem_ -> Dependence () [indexVar];
142 if (dependence.size () == 0) {
146 if (fabs (info -> upper_ [indexVar] -
147 info -> lower_ [indexVar]) /
148 (1. + fabs (info -> solution_ [indexVar])) <
COUENNE_EPS)
151 intInfeasibility (info -> solution_ [indexVar],
152 info -> lower_ [indexVar],
153 info -> upper_ [indexVar]) : 0;
157 const CouenneObject *obj = problem_ -> Objects () [reference_ -> Index ()];
159 double retval = (obj -> Reference ()) ?
160 (1. - 1. / (1. + info -> upper_ [indexVar] - info -> lower_ [indexVar])) *
161 weiSum * obj -> checkInfeasibility (info) : 0.;
166 CoinMax (retval, intInfeasibility (info -> solution_ [indexVar],
167 info -> lower_ [indexVar],
168 info -> upper_ [indexVar])) :
176 infmin = COIN_DBL_MAX;
178 for (std::set <int>::const_iterator i = dependence.begin ();
179 i != dependence.end (); ++i) {
184 CouNumber infeas = (obj -> Reference ()) ? obj -> checkInfeasibility (info) : 0.;
186 if (infeas > infmax) infmax = infeas;
187 if (infeas < infmin) infmin = infeas;
203 (1. - 1. / (1. + info -> upper_ [indexVar] - info -> lower_ [indexVar])) : 1.) *
213 CoinMax (retval, intInfeasibility (info -> solution_ [indexVar],
214 info -> lower_ [indexVar],
215 info -> upper_ [indexVar])) :
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real fint fint fint fint * info
OsiObject for auxiliary variables $w=f(x)$.
const Ipopt::EJournalCategory J_BRANCHING(Ipopt::J_USER1)
const CouNumber weiMin
weights for computing infeasibility
void fint fint fint real fint real real real real real real real real real * e
double CouNumber
main number type in Couenne
bool isInteger(CouNumber x)
is this number integer?