Changeset 1060

Ignore:
Timestamp:
Feb 1, 2014 12:26:24 PM (6 years ago)
Message:

FP: correct handling of tabu list and solution pool

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

Unmodified
Removed
• trunk/Couenne/src/heuristics/CouenneFPpool.cpp

 r1058 ((*i) -> Image () -> Linearity () > LINEAR)) { double double diff = 0., fval = (*((*i) -> Image ())) (); switch (comparedTerm) { 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_ - COUENNE_EPS * CoinMax (1., CoinMax (objVal_, other.objVal_))); case SUM_INF:      if (maxNLinf_ + maxIinf_ < other.maxNLinf_ + other.maxIinf_)                                             return true; case OBJVAL:       if (objVal_              < other.objVal_ - COUENNE_EPS * CoinMax (1., CoinMax (objVal_, other.objVal_))) return true; case SUM_NINF:     if (nNLinf_   + nIinf_   < other.nNLinf_   + other.nIinf_)                                               return true; // so that if objective is close these two solutions will be deemed equal case ALL_VARS: { // lexicographical comparison: unless the two solutions have the // same subvector, comparison will tell them apart for (std::vector ::iterator i = problem_ -> Variables (). begin (); i != problem_ -> Variables (). end (); ++i) if ((*i) -> Multiplicity () > 0) { int indVar = (*i) -> Index (); if (x_ [indVar] < other.x_ [indVar] - COUENNE_EPS) return true; } return false; } case INTEGER_VARS: { // lexicographical comparison: unless the two solutions have the // same integer subvector, comparison will tell them apart for (std::vector ::iterator i = problem_ -> Variables (). begin (); i != problem_ -> Variables (). end (); ++i) if (((*i) -> Multiplicity () > 0) && (*i) -> isInteger ()) { int indVar = (*i) -> Index (); case INTEGER_VARS: { // lexicographical comparison: unless the two solutions have the // same integer subvector, comparison will tell them apart for (std::vector ::iterator i = problem_ -> Variables (). begin (); i != problem_ -> Variables (). end (); ++i) if (((*i) -> Multiplicity () > 0) && (*i) -> isInteger ()) { int indVar = (*i) -> Index (); if (x_ [indVar] < other.x_ [indVar] - COUENNE_EPS) return true; } return false; } if (x_ [indVar] > other.x_ [indVar] + COUENNE_EPS) return false; } return true; } case ALL_VARS: { // lexicographical comparison: unless the two solutions have the // same subvector, comparison will tell them apart for (std::vector ::iterator i = problem_ -> Variables (). begin (); i != problem_ -> Variables (). end (); ++i) if ((*i) -> Multiplicity () > 0) { int indVar = (*i) -> Index (); if (x_ [indVar] > other.x_ [indVar] + COUENNE_EPS) return false; } return true; } }
• trunk/Couenne/src/heuristics/CouenneFPscipSolve.cpp

 r1059 // } /* FIXME: restore assert (fabs (lbs [j] - problem_ -> Lb (j)) < SCIPfeastol (scip)); assert (fabs (ubs [j] - problem_ -> Ub (j)) < SCIPfeastol (scip)); assert (nEntries <= 2*nvars - 2); */ double x_rounded = floor (x [j] + .5); SCIP_CALL( SCIPsetLongintParam(scip, "limits/stallnodes", 1000) ); SCIP_CALL( SCIPsetLongintParam(scip, "limits/nodes", 10000) ); SCIP_CALL( SCIPsetRealParam   (scip, "limits/gap", .001) ); // disable cutting plane separation SCIP_CALL( SCIPsetLongintParam(scip, "limits/stallnodes", 500) ); SCIP_CALL( SCIPsetLongintParam(scip, "limits/nodes", 5000) ); SCIP_CALL( SCIPsetRealParam   (scip, "limits/gap", .005) ); // disable expensive dual techniques
• trunk/Couenne/src/heuristics/CouenneFeasPump.cpp

 r1058 if (tabuPool_ . find (newSol) == tabuPool_ . end ()) { //tabuPool_ . insert (newSol); try_again = true; break; //    pool and use it instead problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: %d solutions in pool, %d in tabu list\n", pool_ -> Set (). size (), tabuPool_ . size ()); CouenneFPsolution checkedSol (problem_, iSol, false); // false is for not allocating space for this // try to find non-tabu solution in the solution pool do { // retrieve the top 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 ()) break; // the pool is empty -> bail out if (pool_ -> Set ().empty ()) { delete[] iSol; iSol = NULL; } // retrieve the top 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 ()) { tabuPool_ . insert (newSol); break; } // the pool is empty -> just round if (pool_ -> Set ().empty ()) { int n = problem_ -> nVars (); if (!iSol) iSol = new double [n]; for (int i=0; i Var (i) -> isInteger ()) ? COUENNE_round (nSol [i]) : nSol [i]; // delete[] iSol; // iSol = NULL; } } while( !pool_ -> Set ().empty() ); } } } } if (!iSol) break; problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: checking IP solution for feasibility\n"); // we found a solution that is not in the tabu list if (tabuPool_ . find (newSol) == tabuPool_ . end ()) { tabuPool_ . insert (newSol); try_again = true; break;
• trunk/Couenne/src/heuristics/CouenneFeasPumpConstructors.cpp

 r1058 2: objective value; \ 3: compare value of all variables; \ 4: compare value of all integers."); } 4: compare value of all integers (RECOMMENDED)."); }
Note: See TracChangeset for help on using the changeset viewer.