void OLCDijkstra::add_edges(DijkstraTaskPoint &dijkstra, const ScanTaskPoint& origin) { ScanTaskPoint destination(origin.first + 1, origin.second); find_solution(dijkstra, origin); for (; destination.second != n_points; ++destination.second) { if (admit_candidate(destination)) { const unsigned d = get_weighting(origin.first) * distance(origin, destination); dijkstra.link(destination, origin, d); } } }
void ContestDijkstra::add_start_edges() { dijkstra.pop(); assert(num_stages <= MAX_STAGES); assert(n_points > 0); ScanTaskPoint destination(0, 0); const ScanTaskPoint end(num_stages-1, n_points-1); for (; destination.point_index != n_points; ++destination.point_index) { // only add points that are valid for the finish solution[0] = GetPointFast(destination); if (admit_candidate(end)) { dijkstra.link(destination, destination, 0); } } }
void ContestDijkstra::add_edges(const ScanTaskPoint& origin) { ScanTaskPoint destination(origin.stage_number + 1, origin.point_index); find_solution(origin); // only add last point! if (is_final(destination)) { assert(n_points > 0); destination.point_index = n_points - 1; } for (; destination.point_index != n_points; ++destination.point_index) { if (admit_candidate(destination)) { const unsigned d = get_weighting(origin.stage_number) * distance(origin, destination); dijkstra.link(destination, origin, d); } } }
bool OLCDijkstra::finish_satisfied(const ScanTaskPoint &sp) const { return admit_candidate(sp); }