Ejemplo n.º 1
0
bool
TaskDijkstra::run()
{
  const bool retval = distance_general();
  if (retval)
    save();
  dijkstra.clear();
  return retval;
}
Ejemplo n.º 2
0
bool
OLCDijkstra::solve_inner()
{
  if (distance_general(m_dijkstra, 25)) {
    save_solution();
    return true;
  }

  return false;
}
Ejemplo n.º 3
0
bool
ContestDijkstra::Solve(bool exhaustive)
{
  if (dijkstra.empty()) {
    set_weightings();
    dijkstra.reserve(CONTEST_QUEUE_SIZE);
  }

  assert(num_stages <= MAX_STAGES);

  if (dijkstra.empty()) {

    update_trace();
    if (n_points < num_stages)
      return true;

    // don't re-start search unless we have had new data appear
    if (!trace_dirty) {
      return true;
    }
  } else if (exhaustive) {
    update_trace();
    if (n_points < num_stages)
      return true;
  } else if (n_points < num_stages) {
    update_trace();
    return true;
  }

  if (trace_dirty) {
    trace_dirty = false;

    dijkstra.restart(ScanTaskPoint(0, 0));
    start_search();
    add_start_edges();
    if (dijkstra.empty()) {
      return true;
    }
  }

#ifdef INSTRUMENT_TASK
  count_olc_solve++;
  count_olc_size = max(count_olc_size, dijkstra.queue_size());
#endif

  if (distance_general(exhaustive ? 0 - 1 : 25)) {
    SaveSolution();
    update_trace();
    return true;
  }

  return !dijkstra.empty();
}