/*---------------------------------------------------------------------- ILOG Planner search macros ----------------------------------------------------------------------*/ IlcSimplex smplx; IlcGoal (*boundMixedVar) (IlcIntVar, IlcLinearSolver); IlcChooseMixedIndex1(MostNotInteger, -smplx.distToInt(val), IlcIntVar) IlcChooseMixedIndex1(LeastNotInteger, smplx.distToInt(val), IlcIntVar) IlcInt (*chooseMixedIndex) (const IlcIntVarArray, IlcLinearSolver); void LogLine ( IlcInt count, IlcInt minmax, IlcInt index, IlcFloat latestObj) { IlcManager mip = smplx.getManager(); static IlcFloat best = minmax == 0 ? Infinity : negInfinity; if (index == -1) { //new integer solution if (minmax == 0) { if (latestObj < best - smplx.getFuzzValue()) { best = latestObj; printf ("*%6d %13.4f %5d %6d\n", count, best, mip.getNumberOfChoicePoints(), smplx.getNbOfIterations()); return; } } else { if (latestObj > best + smplx.getFuzzValue()) { best = latestObj; printf ("*%6d %13.4f %5d %6d\n", count, best, mip.getNumberOfChoicePoints(), smplx.getNbOfIterations()); return; } } if (ilcDispFreq > 0 && count % ilcDispFreq == 0) printf (" %6d %13.4f %5d %6d\n", count, best, mip.getNumberOfChoicePoints(), smplx.getNbOfIterations()); } else { //fractional solution if (best == Infinity || best == negInfinity) printf (" %6d %5d %6d\n", count, mip.getNumberOfChoicePoints(), smplx.getNbOfIterations()); else printf (" %6d %13.4f %5d %6d\n", count, best, mip.getNumberOfChoicePoints(), smplx.getNbOfIterations()); } } ILCGOAL4(MixedGenerateInt, IlcIntVarArray, vars, IlcIntVar, z, IlcSimplex, smplx, IlcInt, minmax) { static IlcInt count = 0; count++; IlcInt index = chooseMixedIndex(vars,smplx); if (index == -1) { smplx.trySolution(); if (ilcDisplay > 0) LogLine (count, minmax, index, smplx.getCurrentValue(z)); return 0; } else { if (ilcDisplay > 0 && ilcDispFreq > 0 && count % ilcDispFreq == 0) LogLine (count, minmax, index, smplx.getCurrentValue(z)); return IlcAnd(boundMixedVar(vars[index],smplx), this); } } ILCGOAL4(MixedGenerateFloat, IlcIntVarArray, vars, IlcFloatVar, z, IlcSimplex, smplx, IlcInt, minmax) { static IlcInt count = 0; count++; IlcInt index = chooseMixedIndex(vars,smplx); if (index == -1) { smplx.trySolution(); if (ilcDisplay > 0) LogLine (count, minmax, index, smplx.getCurrentValue(z)); return 0; } else { if (ilcDisplay > 0 && ilcDispFreq > 0 && count % ilcDispFreq == 0) LogLine (count, minmax, index, smplx.getCurrentValue(z)); return IlcAnd(boundMixedVar(vars[index],smplx), this); } }