Пример #1
0
static bool
RunContest(AbstractContest &_contest,
           ContestResult &result, ContestTraceVector &solution,
           bool exhaustive)
{
    // run solver, return immediately if further processing is required
    // by subsequent calls
    SolverResult r = _contest.Solve(exhaustive);
    if (r != SolverResult::VALID)
        return r != SolverResult::INCOMPLETE;

    // if no improved solution was found, must have finished processing
    // with invalid data
    result = _contest.GetBestResult();

    // solver finished and improved solution was found.  save solution
    // and retrieve new trace.

    solution = _contest.GetBestSolution();

    return true;
}
Пример #2
0
bool
ContestManager::RunContest(AbstractContest &_contest,
                           ContestResult &result,
                           ContestTraceVector &solution,
                           bool exhaustive)
{
  // run solver, return immediately if further processing is required
  // by subsequent calls
  if (!_contest.Solve(exhaustive))
    return false;

  // if no improved solution was found, must have finished processing
  // with invalid data
  if (!_contest.Score(result))
    return true;

  // solver finished and improved solution was found.  save solution
  // and retrieve new trace.

  _contest.CopySolution(solution);

  return true;
}