# Changeset 1058

Ignore:
Timestamp:
Feb 1, 2014 8:50:36 AM (6 years ago)
Message:

making the FP a little more robust. Small fixes

Location:
trunk/Couenne/src/heuristics
Files:
7 edited

Unmodified
Removed
• ## trunk/Couenne/src/heuristics/CouenneFPSolveMILP.cpp

 r1011 if( SCIPisInfinity(scip, val) && val < infinity) problem_ -> Jnlst () -> Printf (Ipopt::J_WARNING, J_NLPHEURISTIC, "Warning: %g will be considered to be Infinity by SCIP.\n"); "Warning: %g will be considered to be Infinity by SCIP.\n", val); } #endif
• ## trunk/Couenne/src/heuristics/CouenneFPSolveNLP.cpp

 r1011 else nSol = CoinCopyOfArray (nlp_ -> getSolution (), problem_ -> nVars ()); else problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: warning, NLP returns a NULL solution\n"); else problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: warning, NLP returns a NULL solution\n"); if (nlp_ -> getSolution () && (problem_ -> Jnlst () -> ProduceOutput (J_ALL, J_NLPHEURISTIC))) { // check if non-NULL
• ## trunk/Couenne/src/heuristics/CouenneFPpool.cpp

 r1011 case SUM_NINF:     return (nNLinf_   + nIinf_   < other.nNLinf_   + other.nIinf_); case SUM_INF:      return (maxNLinf_ + maxIinf_ < other.maxNLinf_ + other.maxIinf_); case OBJVAL:       return (objVal_              < other.objVal_); case OBJVAL:       return (objVal_              < other.objVal_ - COUENNE_EPS * CoinMax (1., CoinMax (objVal_, other.objVal_))); // so that if objective is close these two solutions will be deemed equal case ALL_VARS: { // lexicographical comparison: unless the two solutions have the for (std::vector ::iterator i = problem_ -> Variables (). begin (); i != problem_ -> Variables (). end (); ++i) { int indVar = (*i) -> Index (); if (((*i) -> Multiplicity () > 0) && (x_ [indVar] < other.x_ [indVar] - COUENNE_EPS)) return true; } ++i) if ((*i) -> Multiplicity () > 0) { int indVar = (*i) -> Index (); if (x_ [indVar] < other.x_ [indVar] - COUENNE_EPS) return true; } return false; } case INTEGER_VARS: { for (std::vector ::iterator i = problem_ -> Variables (). begin (); i != problem_ -> Variables (). end (); ++i) { int indVar = (*i) -> Index (); if (((*i) -> Multiplicity () > 0) && ((*i) -> isInteger ())        && (x_ [indVar] < other.x_ [indVar] - COUENNE_EPS)) return true; } ++i) if (((*i) -> Multiplicity () > 0) && (*i) -> isInteger ()) { int indVar = (*i) -> Index (); if (x_ [indVar] < other.x_ [indVar] - COUENNE_EPS) return true; } return false;
• ## trunk/Couenne/src/heuristics/CouenneFPscipSolve.cpp

 r1011 if (problem_ -> Var (j) -> isInteger () && problem_ -> Var (j) -> Multiplicity () > 0 && problem_ -> Ub (j) - problem_ -> Lb (j) > .5) { problem_ -> Ub  (j) - problem_ -> Lb (j) > .5) { // if (fabs (x [j] - floor (x [j] + .5)) >= SCIPfeastol (scip)) { assert (fabs (lbs [j] - problem_ -> Lb (j)) < SCIPfeastol (scip)); assert (fabs (ubs [j] - problem_ -> Ub (j)) < SCIPfeastol (scip)); assert (fabs (x [j] - floor (x [j] + .5))   < 1e3 * SCIPfeastol (scip)); assert (fabs (x [j] - floor (x [j] + .5))   < SCIPfeastol (scip) * 1.e3); assert (nEntries <= 2*nvars - 2); currentmilpmethod = milpMethod_; // use a fixed method to solve the MILP // MILP solving loop. If the MILP terminates without a solution, it might get resolved with a more expensive atrategy do {
• ## trunk/Couenne/src/heuristics/CouenneFeasPump.cpp

 r1057 // and set it as initial (obviously NLP feasible) solution nlp_ -> setInitSol (problem_ -> domain () -> x ()); nlp_ -> setInitSol (sol); //////////////////////////////////////////////////////////////// // l-1 distance from. If nSol==NULL, the MILP is created using the // original milp's LP solution. bool bad_IP_sol = false; double z = solveMILP (nSol, iSol, niter, &nsuciter); } } if (!try_again) { // try moving around current solution bad_IP_sol = true; // SCIP could not find a MILP solution and we're somewhat // locked. Round current solution and feed it to the NLP. This // is better than just bailing out. int n = problem_ -> nVars (); if (!iSol) iSol = new double [n]; for (int i=0; i Var (i) -> isInteger ()) ? COUENNE_round (nSol [i]) : nSol [i]; } if (!try_again) { // nothing to do, bail out problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: could not find from pool either, bailing out\n"); break; } // if (!try_again) { // nothing to do, bail out //        problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: could not find from pool either, bailing out\n"); //        break; // } } CouenneFPsolution checkedSol (problem_, iSol, false); // false is for not allocating space for this if (tabuPool_. find (checkedSol) == tabuPool_ . end ()) if (tabuPool_. find (checkedSol) == tabuPool_ . end ()) tabuPool_. insert (CouenneFPsolution (problem_, iSol)); // only insertion to tabu pool: we check its feasibility now } // ONLY do the following if we didn't get a good IP solution // earlier (i.e. if we had to round) // find non-tabu solution in the solution pool while (!pool_ -> Set (). empty ()) { // EXTRACT the closest (to nSol) IP solution from the pool pool_ -> findClosestAndReplace (iSol, nSol, problem_ -> nVars ()); CouenneFPsolution newSol (problem_, iSol); // we found a solution that is not in the tabu list if (tabuPool_ . find (newSol) == tabuPool_ . end ()) { try_again = true; break; } } if (bad_IP_sol) while (!pool_ -> Set (). empty ()) { // EXTRACT the closest (to nSol) IP solution from the pool pool_ -> findClosestAndReplace (iSol, nSol, problem_ -> nVars ()); CouenneFPsolution newSol (problem_, iSol); // we found a solution that is not in the tabu list if (tabuPool_ . find (newSol) == tabuPool_ . end ()) { try_again = true; break; } } } while (try_again); // Update lb/ub on milp and nlp here const CouNumber const CouNumber *plb = problem_ -> Lb (), *pub = problem_ -> Ub (),
• ## trunk/Couenne/src/heuristics/CouenneFeasPump.hpp

 r1025 {return nlp_;} /// return number of calls (can be changeD) /// return number of calls (can be changed) int &nCalls () {return nCalls_;} /// MILP phase of the FP int milpPhase (double *nSol, double *iSol); /// NLP phase of the FP int nlpPhase (double *iSol, double *nSol); #ifdef COIN_HAS_SCIP
• ## trunk/Couenne/src/heuristics/CouenneFeasPumpConstructors.cpp

 r1032 roptions -> AddBoundedIntegerOption ("feas_pump_nseprounds", "Number of rounds that separate convexification cuts. Must be at least 1", "Number of rounds of convexification cuts. Must be at least 1", 1, 1e5, 4, ""); ("feas_pump_poolcomp", "Priority field to compare solutions in FP pool", 0, 2, 0, "0: total number of infeasible objects (integer and nonlinear), 1: maximum infeasibility (integer or nonlinear), 2: objective value."); } 0, 4, 4, "\ 0: total number of infeasible objects (integer and nonlinear); \ 1: maximum infeasibility (integer or nonlinear); \ 2: objective value; \ 3: compare value of all variables; \ 4: compare value of all integers."); }
Note: See TracChangeset for help on using the changeset viewer.