diff --git a/r2sol-old.cc b/r2sol-old.cc index c3b37f6032c2b0315586e21db6c400bb9a4553d8..7ae3f3484157a4116d89a1a57d527e4396e5a56b 100644 --- a/r2sol-old.cc +++ b/r2sol-old.cc @@ -72,7 +72,7 @@ namespace SOLVE { FILE* fin; char fname[128]; -int H, W, T, N, TINIT; +int H, W, T, TEST, N, TINIT; double TSTART; struct Node { @@ -98,7 +98,8 @@ void ReadTransitionsMap() { } } nnodes = 0; - T = 8 * (H + W + 20); + T = TMAX - 7; + //T = 8 * (H + W + 20); int row, col, o1, o2, num_transitions = 0; while (fscanf(fin, "%d %d %d %d", &row, &col, &o1, &o2) == 4) { if (row < 0 || col < 0 || o1 < 0 || o2 < 0) break; @@ -314,11 +315,45 @@ bool reschedule; int num_done_agents, num_planned, num_reschedules, num_adjust_ipaths; int num_adjust_ipaths_without_full_plan_regeneration; +int important_row[2 * NMAX], important_col[2 * NMAX]; +char visited[2 * NMAX]; + +void DFSMarkCities(int aid) { + visited[aid] = 1; + static const int kMaxDiff = 2; + for (int aid2 = 0; aid2 < 2 * N; ++aid2) { + if (visited[aid2]) continue; + if (abs(important_row[aid] - important_row[aid2]) <= kMaxDiff && abs(important_col[aid] - important_col[aid2]) <= kMaxDiff) + DFSMarkCities(aid2); + } +} + +void EstimateT() { + for (int aid = 0; aid < N; ++aid) { + const auto& agent_aid = agent[aid]; + important_row[2 * aid] = agent_aid.poz_row; + important_col[2 * aid] = agent_aid.poz_col; + important_row[2 * aid + 1] = agent_aid.target_row; + important_col[2 * aid + 1] = agent_aid.target_col; + visited[2 * aid] = visited[2 * aid + 1] = 0; + } + int num_cities = 0; + for (int aid = 0; aid < 2 * N; ++aid) { + if (visited[aid]) continue; + DFSMarkCities(aid); + ++num_cities; + } + if (1.0 * N / num_cities < 20.0 - 1e-6) + TEST = (int)(8.0 * (H + W + 1.0 * N / num_cities)); + else + TEST = 8 * (H + W + 20); + DBG(0, "(estimated) num_cities=%d TEST=%d\n", num_cities, TEST); +} + void ReadAgentsData(bool replay_mode = false) { fscanf(fin, "%d %d", &N, &TINIT); DBG(2, "[ReadAgentsData] N=%d TINIT=%d/%d\n", N, TINIT, T); assert(1 <= N && N < NMAX); - assert(TINIT < T); if (replay_mode) { fscanf(fin, "%d %d %d", &num_reschedules, &num_planned, &num_adjust_ipaths_without_full_plan_regeneration); reschedule = TINIT == 0; @@ -445,6 +480,11 @@ void ReadAgentsData(bool replay_mode = false) { } } + if (TINIT == 0 || replay_mode) { + if (TINIT == 0) EstimateT(); + else fscanf(fin, "%d", &T); + } + //exit(1); } @@ -707,8 +747,21 @@ bool OverlapsOngoingMove(int t1, int t2, int node, const int covered_by[][MAXNOD if (!USE_SPACING_TO_AVOID_DEADLOCKS) return false; if (t1 < tend_ongoing_move[node]) return true; + //if (t2 <= tend_ongoing_move[node]) return true; + + const int min_tstart = t2;//USE_STRICT_SPACING_TO_AVOID_DEADLOCKS ? t2 : t1; + //const int min_tstart = t1;//USE_STRICT_SPACING_TO_AVOID_DEADLOCKS ? t2 : t1; + const int aid_t1 = is_covered[t1][node] == is_covered_idx ? covered_by[t1][node] : -1; + for (int tend = t2 + 1; tend <= t2 + 3 && tend <= T; ++tend) { + if (is_covered[tend][node] == is_covered_idx) { + const auto& aid = covered_by[tend][node]; + const auto& agent_aid = agent[aid]; + if (tend - agent_aid.cturns < min_tstart && (aid != aid_t1 || is_covered[tend - 1][node] != is_covered_idx)) return true; + } + } + if (USE_STRICT_SPACING_TO_AVOID_DEADLOCKS) { for (int tend = t1 + 1; tend <= t2; ++tend) { if (is_covered[tend][node] == is_covered_idx) { @@ -718,15 +771,6 @@ bool OverlapsOngoingMove(int t1, int t2, int node, const int covered_by[][MAXNOD } } - const int min_tstart = t2;//USE_STRICT_SPACING_TO_AVOID_DEADLOCKS ? t2 : t1; - for (int tend = t2 + 1; tend <= t2 + 3 && tend <= T; ++tend) { - if (is_covered[tend][node] == is_covered_idx) { - const auto& aid = covered_by[tend][node]; - const auto& agent_aid = agent[aid]; - if (tend - agent_aid.cturns < min_tstart && (aid != aid_t1 || is_covered[tend - 1][node] != is_covered_idx)) return true; - } - } - /*for (int tend = t2 + 1; tend <= t2 + 3 && tend <= T; ++tend) { if (is_covered[tend][node] == is_covered_idx) { const auto& aid = covered_by[tend][node]; @@ -775,7 +819,7 @@ bool FindBestPath(int aid, const int covered_by[][MAXNODES], const int is_covere if (!agent_aid.inside_poz) { rnode = agent_aid.poz_node; ro = agent_aid.poz_o; - t1 = TINIT + max(agent_aid.malfunc - 1/*2*/, 0); + t1 = TINIT + max(agent_aid.malfunc - 1, 0); for (int tstart = t1; tstart < T; ++tstart) { if (!CanEnterCell(aid, tstart + 1, -1, rnode, covered_by, is_covered, is_covered_idx, tmp_path)) continue; int t2 = tstart + 1; @@ -839,22 +883,27 @@ bool FindBestPath(int aid, const int covered_by[][MAXNODES], const int is_covere } } - int TMIN = T + 1, best_o = -1; - - /*if (aid == 126 || aid == 50) { - DBG(0, ">>> aid=%d\n", aid); - for (int t = 40; t <= 50 && t <= ipath[aid].tmax; ++t) DBG(0, " t=%d node=%d\n", t, ipath[aid].p[t].node); - }*/ - + int TMIN = T + 1, best_o = -1, best_node = -1, best_t1 = -1; + if (tmp_path_aid.tmax < TINIT || tmp_path_aid.p[tmp_path_aid.tmax].node == agent_aid.target_node) TMIN = tmp_path_aid.tmax; - while (hsize >= 1 /*&& TMIN > T*/) { + while (hsize >= 1) { int t, node, o, ct1; ExtractMinFromHeap(h, hsize, t, node, o, ct1); - //DBG(0, "aid=%d hsize=%d t=%d node=%d o=%d ct1=%d can_reach=%d/%d\n", aid, hsize, t, node, o, ct1, can_reach[t][node][o], can_reach_idx); + assert(0 <= t && t <= T); assert(can_reach[t][node][o] == can_reach_idx); if (ct1 != can_reach_with_t1[t][node][o]) continue; - if (t + dmin_aid[node][o] >= TMIN) break; + + if (best_node == target_node && t + dmin_aid[node][o] > TMIN) break; + if (t > TMIN || t > T) continue; + + if (t == T && (best_node < 0 || (best_node >= 0 && best_node != target_node && best_t1 < ct1))) { + TMIN = t; + best_node = node; + best_o = o; + best_t1 = ct1; + //assert(false); + } // Case 1: Wait. if (t + 1 < TMIN && CanEnterCell(aid, t + 1, node, node, covered_by, is_covered, is_covered_idx, tmp_path) && @@ -868,10 +917,10 @@ bool FindBestPath(int aid, const int covered_by[][MAXNODES], const int is_covere new_prev.o = o; new_prev.type = WAITED; const int est_tmin = t + 1 + dmin_aid[node][o]; - if (est_tmin < TMIN) InsertIntoHeap(h, hsize, t + 1, node, o, ct1, est_tmin); + if ((t + 1 <= T && best_node != target_node) || est_tmin <= TMIN) InsertIntoHeap(h, hsize, t + 1, node, o, ct1, est_tmin); } - if (t + cturns >= TMIN) continue; + if (t + cturns > TMIN) continue; const int tarrive_node2 = t + cturns; if (!IsFreeTimeWindow(aid, t + 1, tarrive_node2 - 1, node, covered_by, is_covered, is_covered_idx, tmp_path)) continue; @@ -893,7 +942,7 @@ bool FindBestPath(int aid, const int covered_by[][MAXNODES], const int is_covere new_prev.o = o; new_prev.type = STARTED_MOVING; const int est_tmin = tarrive_node2 + dmin_aid[node2][onext]; - if (est_tmin < TMIN) InsertIntoHeap(h, hsize, tarrive_node2, node2, onext, ct1, est_tmin); + if ((tarrive_node2 <= T && best_node != target_node) || est_tmin <= TMIN) InsertIntoHeap(h, hsize, tarrive_node2, node2, onext, ct1, est_tmin); } else { can_reach[tarrive_node2][node2][onext] = can_reach_idx; can_reach_with_t1[tarrive_node2][node2][onext] = ct1; @@ -902,24 +951,40 @@ bool FindBestPath(int aid, const int covered_by[][MAXNODES], const int is_covere new_prev.node = node; new_prev.o = o; new_prev.type = STARTED_MOVING; - if (tarrive_node2 < TMIN) { + if (best_node != target_node || tarrive_node2 < TMIN || (tarrive_node2 == TMIN && best_t1 < ct1)) { TMIN = tarrive_node2; + best_node = target_node; best_o = onext; + best_t1 = ct1; } } } } } + //if (agent_aid.inside_poz) assert(best_o >= 0); if (best_o < 0) return false; + if (best_node != target_node && !agent_aid.inside_poz) { + tmp_path_aid.tmax = T; + for (int t = TINIT; t <= T; ++t) { + auto& new_path_elem = tmp_path_aid.p[t]; + new_path_elem.node = agent_aid.poz_node; + new_path_elem.o = agent_aid.poz_o; + new_path_elem.moving_to_node = new_path_elem.moving_to_o = -1; + new_path_elem.num_partial_turns = 0; + new_path_elem.how_i_got_here = OUTSIDE_SRC; + } + return true; + } + + //assert(best_node == target_node); tmp_path_aid.tmax = TMIN; - int ct = TMIN, cnode = target_node, co = best_o; + int ct = TMIN, cnode = best_node, co = best_o; while (1) { assert(can_reach[ct][cnode][co] == can_reach_idx); assert(ct >= can_reach_with_t1[ct][cnode][co]); const auto& cprev = prev[ct][cnode][co]; - //DBG(0, "ct=%d cnode=%d co=%d cprev.t=%d cprev.type=%d\n", ct, cnode, co, cprev.t, cprev.type); if (cprev.t < 0) break; if (cprev.type == WAITED || cprev.type == MALFUNCTIONED) { // Wait 1 unit. @@ -935,7 +1000,6 @@ bool FindBestPath(int aid, const int covered_by[][MAXNODES], const int is_covere int num_partial_turns = 0; for (int tmove = cprev.t; tmove < ct; ++tmove) { - //DBG(0, " tmove=%d npt=%d\n", tmove, num_partial_turns); auto& new_path_elem = tmp_path_aid.p[tmove + 1]; ++num_partial_turns; if (num_partial_turns < agent_aid.cturns) { @@ -1009,6 +1073,25 @@ void UncoverPath(int aid, const Path& path, int covered_by[][MAXNODES], int is_c } } +void CoverPath1(int aid, const Path& path, int covered_by[][MAXNODES], int is_covered[][MAXNODES], int is_covered_idx) { + const auto& agent_aid = agent[aid]; + if (!agent_aid.inside_poz) return; + for (int t = TINIT; t <= T; ++t) { + assert(is_covered[t][agent_aid.poz_node] != is_covered_idx); + is_covered[t][agent_aid.poz_node] = is_covered_idx; + covered_by[t][agent_aid.poz_node] = aid; + } +} + +void UncoverPath1(int aid, const Path& path, int covered_by[][MAXNODES], int is_covered[][MAXNODES], int is_covered_idx) { + const auto& agent_aid = agent[aid]; + if (!agent_aid.inside_poz) return; + for (int t = TINIT; t <= T; ++t) { + assert(is_covered[t][agent_aid.poz_node] == is_covered_idx && covered_by[t][agent_aid.poz_node] == aid); + is_covered[t][agent_aid.poz_node] = 0; + } +} + bool RunConsistencyChecks(Path path[], const int covered_by[][MAXNODES], const int is_covered[][MAXNODES], int is_covered_idx, bool crash_on_error = true) { for (int aid = 0; aid < N; ++aid) { const auto& agent_aid = agent[aid]; @@ -1160,10 +1243,12 @@ void CheckNonDeadlockPaths() { } } -const double kScoreExponent = 1.0;//2.0; -const double kMaxTmaxWeight = 0.0; +double SCORE_EXPONENT1, SCORE_EXPONENT2; +double MAX_TMAX_WEIGHT; -void RandomPermutations(int tid, int ntries) { +#define GetScore(t) (t <= TEST ? pow(1.0 * t / TEST, SCORE_EXPONENT1) : pow(1.0 * t / TEST, SCORE_EXPONENT2)) + +/*void RandomPermutations(int tid, int ntries) { auto& pused_tid = pused[tid]; auto& perm_tid = perm[tid]; auto& xor128_tid = xor128[tid]; @@ -1198,20 +1283,20 @@ void RandomPermutations(int tid, int ntries) { int last_trial_update = -1, last_idx_update = -1; for (int trial = 1; trial <= ntries; ++trial) { - if (0&&tid == 0 && trial <= 2) { + if (tid == 0 && trial <= 1) { if (trial == 2) reverse(shpaths_sorted.begin(), shpaths_sorted.end()); for (int i = 0; i < N; ++i) perm_tid[i] = shpaths_sorted[i].second; } else { for (int i = 0; i < N; ++i) pused_tid[i] = 0; int idx = 0; - if ((trial & 3) >= 2) { + if ((0&&trial & 3) >= 2) { for (int i = 0; i < N; ++i) { do { perm_tid[idx] = xor128_tid.rand() % N; } while (pused_tid[perm_tid[idx]]); pused_tid[perm_tid[idx++]] = 1; } - } else if ((trial & 3) == 1) { + } else if (0&&(trial & 3) == 1) { for (int cturns = MAX_CTURNS - 1; cturns >= 0; --cturns) { const auto& cturns_agents_cturns = cturns_agents[cturns]; const auto& num_cturns_agents_cturns = num_cturns_agents[cturns]; @@ -1308,19 +1393,140 @@ void RandomPermutations(int tid, int ntries) { } } } +*/ + +void RandomPermutations(int tid, int ntries) { + auto& pused_tid = pused[tid]; + auto& perm_tid = perm[tid]; + auto& xor128_tid = xor128[tid]; + auto& covered_by_tid = covered_by[tid]; + auto& is_covered_tid = is_covered[tid]; + auto& is_covered_idx_tid = is_covered_idx[tid]; + auto& can_reach_tid = can_reach[tid]; + auto& can_reach_idx_tid = can_reach_idx[tid]; + auto& can_reach_with_t1_tid = can_reach_with_t1[tid]; + auto& heap_tid = heap[tid]; + auto& heap_size_tid = heap_size[tid]; + auto& prev_tid = prev[tid]; + auto& tmp_path_tid = tmp_path[tid]; + auto& tmp_path2_tid = tmp_path2[tid]; + auto& tmax_at_poz_node_tid = tmax_at_poz_node[tid]; + + if (tid == 0) { + shpaths_sorted.resize(N); + for (int aid = 0; aid < N; ++aid) { + shpaths_sorted[aid].second = aid; + const auto& agent_aid = agent[aid]; + shpaths_sorted[aid].first = agent_aid.malfunc + dmin[aid][agent_aid.poz_node][agent_aid.poz_o]; + } + sort(shpaths_sorted.begin(), shpaths_sorted.end()); + } + + for (int trial = 1; trial <= ntries; ++trial) { + if (tid == 0 && trial <= 1) { + for (int i = 0; i < N; ++i) perm_tid[i] = shpaths_sorted[i].second; + reverse(shpaths_sorted.begin(), shpaths_sorted.end()); + } else { + for (int i = 0; i < N; ++i) pused_tid[i] = 0; + int idx = 0; + if (0&&(trial & 1) == 1) { + for (int cturns = MAX_CTURNS - 1; cturns >= 0; --cturns) { + const auto& cturns_agents_cturns = cturns_agents[cturns]; + const auto& num_cturns_agents_cturns = num_cturns_agents[cturns]; + for (int i = 0; i < num_cturns_agents_cturns; ++i) { + do { + perm_tid[idx] = cturns_agents_cturns[xor128_tid.rand() % num_cturns_agents_cturns]; + } while (pused_tid[perm_tid[idx]]); + pused_tid[perm_tid[idx++]] = 1; + } + } + } else { + for (int cturns = 0; cturns < MAX_CTURNS; ++cturns) { + const auto& cturns_agents_cturns = cturns_agents[cturns]; + const auto& num_cturns_agents_cturns = num_cturns_agents[cturns]; + for (int i = 0; i < num_cturns_agents_cturns; ++i) { + do { + perm_tid[idx] = cturns_agents_cturns[xor128_tid.rand() % num_cturns_agents_cturns]; + } while (pused_tid[perm_tid[idx]]); + pused_tid[perm_tid[idx++]] = 1; + } + } + } + } + ++is_covered_idx_tid; + for (int aid = 0; aid < N; ++aid) { + auto& tmax_at_poz_node_tid_aid = tmax_at_poz_node_tid[aid]; + tmax_at_poz_node_tid_aid = -1; + auto& tmp_path_tid_aid = tmp_path_tid[aid]; + CopyPath(ipath[aid], &tmp_path_tid_aid); + const auto& agent_aid = agent[aid]; + if (agent_aid.status == DONE_REMOVED) continue; + CoverPath(aid, tmp_path_tid_aid, covered_by_tid, is_covered_tid, is_covered_idx_tid); + if (agent_aid.inside_poz) { + tmax_at_poz_node_tid_aid = TINIT; + for (int t = TINIT + 1; t <= tmp_path_tid_aid.tmax; ++t) { + const auto& path_elem = tmp_path_tid_aid.p[t]; + if (path_elem.node != agent_aid.poz_node) break; + tmax_at_poz_node_tid_aid = t; + } + } + } + bool inconsistent = false; + for (int idx = 0; idx < N; ++idx) { + const auto& aid = perm_tid[idx]; + const auto& agent_aid = agent[aid]; + if (agent_aid.status == DONE_REMOVED) continue; + auto& tmp_path_tid_aid = tmp_path_tid[aid]; + UncoverPath(aid, tmp_path_tid_aid, covered_by_tid, is_covered_tid, is_covered_idx_tid); + if (!FindBestPath(aid, covered_by_tid, is_covered_tid, is_covered_idx_tid, can_reach_tid, can_reach_idx_tid, can_reach_with_t1_tid, heap_tid, heap_size_tid, prev_tid, tmp_path_tid, &tmp_path2_tid[aid], tmax_at_poz_node_tid)) { + //inconsistent = true; + //break; + } + CoverPath(aid, tmp_path_tid_aid, covered_by_tid, is_covered_tid, is_covered_idx_tid); + } + if (!inconsistent && RunConsistencyChecks(tmp_path_tid, covered_by_tid, is_covered_tid, is_covered_idx_tid, false)) { + int num_done_agents = 0; + double cost = 0.0; + int max_tmax = 0; + for (int aid = 0; aid < N; ++aid) { + const auto& agent_aid = agent[aid]; + if (agent_aid.status == DONE_REMOVED) continue; + const auto& tmp_path_tid_aid = tmp_path_tid[aid]; + assert(tmp_path_tid_aid.tmax > TINIT); + if (tmp_path_tid_aid.tmax > TINIT && tmp_path_tid_aid.tmax <= T && tmp_path_tid_aid.p[tmp_path_tid_aid.tmax].node == agent_aid.target_node) { + ++num_done_agents; + cost += GetScore(tmp_path_tid_aid.tmax); + if (tmp_path_tid_aid.tmax > max_tmax) max_tmax = tmp_path_tid_aid.tmax; + } + } + if (num_done_agents >= 1) cost /= num_done_agents; + + { + lock_guard<mutex> guard(m); + if (num_done_agents > MAX_DONE_AGENTS || (num_done_agents == MAX_DONE_AGENTS && cost < MIN_COST - 1e-6)) { + MAX_DONE_AGENTS = num_done_agents; + MIN_COST = cost; + updated_best_solution = true; + CopyTmpPathToPath(tid); + DBG(0, "[RandomPermutations] rerun=%d tid=%d trial=%d/%d maxda=%d/%d minc=%.6lf time=%.3lf\n", rerun, tid, trial, ntries, MAX_DONE_AGENTS, num_planned, MIN_COST, GetTime() - TSTART); + } + } + } + } +} bool any_best_solution_updates; void RegenerateFullPlan() { + ++num_reschedules; any_best_solution_updates = false; updated_best_solution = true; rerun = 0; - const int kMaxReruns = 2;//4; - + const int kMaxReruns = 4;//2; + while (updated_best_solution && rerun < kMaxReruns) { updated_best_solution = false; - ++num_reschedules; ++rerun; for (int node = 0; node < nnodes; ++node) tend_ongoing_move[node] = TINIT; @@ -1344,7 +1550,7 @@ void RegenerateFullPlan() { if (max_threads >= 2) th = new thread*[max_threads - 1]; // Random Permutations. - const int kNumRandomPermutations = TINIT == 0 ? 10 : 6; + const int kNumRandomPermutations = TINIT == 0 ? 20 /*10*/ : 12 /*6*/; if (max_threads >= 2) { for (int tid = 0; tid + 1 < max_threads; ++tid) th[tid] = new thread([tid, kNumRandomPermutations]{ RandomPermutations(tid, kNumRandomPermutations); @@ -1498,7 +1704,7 @@ bool AdjustIPaths() { else new_path_elem.how_i_got_here = first_expected_step.how_i_got_here; } else new_path_elem.how_i_got_here = OUTSIDE_SRC; - const int tmin = TINIT + max(0, agent_aid.malfunc - (agent_aid.inside_poz ? /*1*/ 0 : /*2*/1)); + const int tmin = TINIT + max(0, agent_aid.malfunc - (agent_aid.inside_poz ? 0 : 1)); for (int t = TINIT + 1; t <= tmin && t <= T; ++t) { auto& new_path_elem = path_aid.p[t]; memcpy(&new_path_elem, &path_aid.p[t - 1], sizeof(PathElem)); @@ -1629,7 +1835,7 @@ bool AdjustIPaths() { int tend_move = ipath_visiting_order_next_node[next_vidx_next_node].first; - //const bool print_debug = (aid == 56 || aid == 49 || aid == 27) && (curr_node == 191 || next_node == 191); + //const bool print_debug = (aid == 76 || aid == 24) && (curr_node == 117 || next_node == 117); const bool print_debug = false; if (print_debug) DBG(0, "\n[AdjustIPaths-Debug-A] aid=%d next_aidx_aid=%d next_node=%d:(%d %d) next_vidx_next_node=%d curr_node=%d:(%d %d) t_curr_node=%d tend_move=%d(init) \n", aid, next_aidx_aid, next_node, node[next_node].row, node[next_node].col, next_vidx_next_node, curr_node, node[curr_node].row, node[curr_node].col, t_curr_node, tend_move); @@ -1738,12 +1944,9 @@ bool AdjustIPaths() { assert(next_vidx_next_node >= 1); const int prev_aid = ipath_visiting_order_next_node[next_vidx_next_node - 1].second; DBG(0, " prev_aid=%d\n", prev_aid); - if (agent_aid.target_node == next_node || agent[prev_aid].target_node == next_node) { - SwapVisitingOrder(aid, next_aidx_aid, prev_aid); - updated_visiting_order = true; - break; - } - exit(1); + SwapVisitingOrder(aid, next_aidx_aid, prev_aid); + updated_visiting_order = true; + break; } if (new_path_elem->node != agent_aid.target_node) { is_covered_0[t][new_path_elem->node] = is_covered_idx_0; @@ -1797,7 +2000,7 @@ bool AdjustIPaths() { const auto& last_path_elem = path_aid1.p[path_aid1.tmax]; int tend_move_aid1 = tend_move + (aid1 < aid && agent[aid1].target_node != next_node ? 1 : 0); const auto& agent_aid1 = agent[aid1]; - if (USE_SPACING_TO_AVOID_DEADLOCKS && last_path_elem.num_partial_turns == 0) { + if (USE_SPACING_TO_AVOID_DEADLOCKS && last_path_elem.num_partial_turns == 0 && (next_aidx[aid1] > next_checkpoint[aid1] || agent[aid1].moving_to_node < 0)) { const int min_tstart = tend_move;//USE_STRICT_SPACING_TO_AVOID_DEADLOCKS ? tend_move : t_curr_node; assert(t_curr_node < tend_move); if (tend_move_aid1 - agent_aid1.cturns < min_tstart) tend_move_aid1 = min_tstart + agent_aid1.cturns; @@ -1819,7 +2022,7 @@ bool AdjustIPaths() { const auto& last_path_elem = path_aid1.p[path_aid1.tmax]; int tend_move_aid1 = tend_move + (aid1 < aid ? 1 : 0); const auto& agent_aid1 = agent[aid1]; - if (USE_SPACING_TO_AVOID_DEADLOCKS && last_path_elem.num_partial_turns == 0) { + if (USE_SPACING_TO_AVOID_DEADLOCKS && last_path_elem.num_partial_turns == 0 && (next_aidx[aid1] > next_checkpoint[aid1] || agent[aid1].moving_to_node < 0)) { const int min_tstart = t_curr_node;//USE_STRICT_SPACING_TO_AVOID_DEADLOCKS ? tend_move : t_curr_node; assert(t_curr_node < tend_move); if (tend_move_aid1 - agent_aid1.cturns < min_tstart) tend_move_aid1 = min_tstart + agent_aid1.cturns; @@ -1956,17 +2159,17 @@ bool AdjustIPaths() { assert(path_aid.tmax > TINIT); if (path_aid.p[path_aid.tmax].node == agent_aid.target_node) { ++MAX_DONE_AGENTS; - MIN_COST += pow(path_aid.tmax, kScoreExponent); + MIN_COST += GetScore(path_aid.tmax); if (path_aid.tmax > new_max_tmax) new_max_tmax = path_aid.tmax; } else { assert(path_aid.tmax == T); } } - MIN_COST += new_max_tmax * kMaxTmaxWeight; - + if (MAX_DONE_AGENTS >= 1) MIN_COST /= MAX_DONE_AGENTS; + const bool changed_important_data = MAX_DONE_AGENTS != num_planned || new_max_tmax > max_tmax; if (changed_important_data) { - DBG(0, ">>> [AdjustIPaths] mda=%d/%d minc=%.3lf new_max_tmax=%d/%d\n", MAX_DONE_AGENTS, num_planned, MIN_COST, new_max_tmax, max_tmax); + DBG(0, ">>> [AdjustIPaths] mda=%d/%d minc=%.6lf new_max_tmax=%d/%d\n", MAX_DONE_AGENTS, num_planned, MIN_COST, new_max_tmax, max_tmax); } CheckNonDeadlockPaths(); @@ -2118,6 +2321,7 @@ void SaveDataForReplay(const char* testid) { fprintf(f, "%d %d %d %d\n", node[checkpoints_aid[cid]].row, node[checkpoints_aid[cid]].col, checkpoints_o_aid[cid], checkpoints_t_aid[cid]); } } + fprintf(f, "%d\n", T); fclose(f); } @@ -2134,6 +2338,8 @@ void GetMoves(const char* testid, bool replay_mode = false) { ReinitDataStructures(); ComputeShortestPaths(); } + SCORE_EXPONENT1 = 2.0;//2.0; + SCORE_EXPONENT2 = 4.0;//3.0; DBG(2, "testid=%s TINIT=%d: resc=%d nda=%d npl=%d\n", testid, TINIT, reschedule, num_done_agents, num_planned); if (reschedule) { if (TINIT >= MIN_TINIT_FOR_SAVE_DATA_FOR_REPLAY) SaveDataForReplay(testid); @@ -2142,7 +2348,7 @@ void GetMoves(const char* testid, bool replay_mode = false) { updated_paths_ok = AdjustIPaths(); ++num_adjust_ipaths_without_full_plan_regeneration; } - const int kMaxNumAdjustIPathsWithoutFullPlanRegenartion = 10; + const int kMaxNumAdjustIPathsWithoutFullPlanRegenartion = 5;//10; if (!updated_paths_ok || num_adjust_ipaths_without_full_plan_regeneration > kMaxNumAdjustIPathsWithoutFullPlanRegenartion) { RegenerateFullPlan(); if (TINIT >= 1 && any_best_solution_updates) AdjustIPaths(); @@ -2152,7 +2358,7 @@ void GetMoves(const char* testid, bool replay_mode = false) { WriteMoves(testid); if (TINIT == 0) total_time = 0.0; total_time += GetTime() - TSTART; - DBG(0, "[GetMoves] testid=%s TINIT=%d/%d ttime=%.3lf nresc=%d nadjip=%d nadjipwofpr=%d nda=%d npl=%d sum=%d/%d(%.2lf)\n", testid, TINIT, T, total_time, num_reschedules, num_adjust_ipaths, num_adjust_ipaths_without_full_plan_regeneration, num_done_agents, num_planned, num_done_agents + num_planned, N, 100.0 * (num_done_agents + num_planned) / N); + DBG(0, "[GetMoves] testid=%s TINIT=%d/%d ttime=%.3lf nresc=%d nadjip=%d nadjipwofpr=%d nda=%d npl=%d sum=%d/%d(%.2lf)\n", testid, TINIT, TEST, total_time, num_reschedules, num_adjust_ipaths, num_adjust_ipaths_without_full_plan_regeneration, num_done_agents, num_planned, num_done_agents + num_planned, N, 100.0 * (num_done_agents + num_planned) / N); /*for (int aid = 0; aid < N; ++aid) { if (aid == 27 || aid == 49 || aid == 56) { @@ -2175,3 +2381,4 @@ int main() { SOLVE::GetMoves("1", true); return 0; } + diff --git a/r2sol.cc b/r2sol.cc index 73bef062cdef18f622da64303186cf189741db2b..20f210bdd70ac9a58926b6b22ed6ef3cee13afbe 100644 --- a/r2sol.cc +++ b/r2sol.cc @@ -98,7 +98,8 @@ void ReadTransitionsMap() { } } nnodes = 0; - T = TMAX - 7;//8 * (H + W + 20); + T = TMAX - 7; + //T = 8 * (H + W + 20); int row, col, o1, o2, num_transitions = 0; while (fscanf(fin, "%d %d %d %d", &row, &col, &o1, &o2) == 4) { if (row < 0 || col < 0 || o1 < 0 || o2 < 0) break; @@ -882,36 +883,43 @@ bool FindBestPath(int aid, const int covered_by[][MAXNODES], const int is_covere } } - int TMIN = T + 1, best_o = -1; + int TMIN = T + 1, best_o = -1, best_node = -1, best_t1 = -1; if (tmp_path_aid.tmax < TINIT || tmp_path_aid.p[tmp_path_aid.tmax].node == agent_aid.target_node) TMIN = tmp_path_aid.tmax; - while (hsize >= 1 /*&& TMIN > T*/) { + while (hsize >= 1) { int t, node, o, ct1; ExtractMinFromHeap(h, hsize, t, node, o, ct1); - //DBG(0, "aid=%d hsize=%d t=%d node=%d o=%d ct1=%d can_reach=%d/%d\n", aid, hsize, t, node, o, ct1, can_reach[t][node][o], can_reach_idx); + assert(0 <= t && t <= T); assert(can_reach[t][node][o] == can_reach_idx); if (ct1 != can_reach_with_t1[t][node][o]) continue; - if (t + dmin_aid[node][o] >= TMIN) break; + if (/*best_node == target_node &&*/ t + dmin_aid[node][o] > TMIN) break; + if (t > T) continue; + + /*if (t == T && (best_node < 0 || (best_node >= 0 && best_node != target_node && best_t1 < ct1))) { + TMIN = t; + best_node = node; + best_o = o; + best_t1 = ct1; + }*/ // Case 1: Wait. - if (t + 1 < TMIN && CanEnterCell(aid, t + 1, node, node, covered_by, is_covered, is_covered_idx, tmp_path) && + if (t + 1 <= TMIN && t + 1 <= T && CanEnterCell(aid, t + 1, node, node, covered_by, is_covered, is_covered_idx, tmp_path) && (can_reach[t + 1][node][o] != can_reach_idx || can_reach_with_t1[t + 1][node][o] < ct1) && (agent_aid.inside_poz || t > ct1)) { - can_reach[t + 1][node][o] = can_reach_idx; - can_reach_with_t1[t + 1][node][o] = ct1; - auto& new_prev = prev[t + 1][node][o]; - new_prev.t = t; - new_prev.node = node; - new_prev.o = o; - new_prev.type = WAITED; - const int est_tmin = t + 1 + dmin_aid[node][o]; - if (est_tmin < TMIN) InsertIntoHeap(h, hsize, t + 1, node, o, ct1, est_tmin); - } - - if (t + cturns >= TMIN) continue; + can_reach[t + 1][node][o] = can_reach_idx; + can_reach_with_t1[t + 1][node][o] = ct1; + auto& new_prev = prev[t + 1][node][o]; + new_prev.t = t; + new_prev.node = node; + new_prev.o = o; + new_prev.type = WAITED; + const int est_tmin = t + 1 + dmin_aid[node][o]; + if (best_node != target_node || est_tmin <= TMIN) InsertIntoHeap(h, hsize, t + 1, node, o, ct1, est_tmin); + } const int tarrive_node2 = t + cturns; + if (tarrive_node2 > TMIN || tarrive_node2 > T) continue; if (!IsFreeTimeWindow(aid, t + 1, tarrive_node2 - 1, node, covered_by, is_covered, is_covered_idx, tmp_path)) continue; // Case 2: Move. @@ -931,7 +939,7 @@ bool FindBestPath(int aid, const int covered_by[][MAXNODES], const int is_covere new_prev.o = o; new_prev.type = STARTED_MOVING; const int est_tmin = tarrive_node2 + dmin_aid[node2][onext]; - if (est_tmin < TMIN) InsertIntoHeap(h, hsize, tarrive_node2, node2, onext, ct1, est_tmin); + if (best_node != target_node || est_tmin <= TMIN) InsertIntoHeap(h, hsize, tarrive_node2, node2, onext, ct1, est_tmin); } else { can_reach[tarrive_node2][node2][onext] = can_reach_idx; can_reach_with_t1[tarrive_node2][node2][onext] = ct1; @@ -940,19 +948,36 @@ bool FindBestPath(int aid, const int covered_by[][MAXNODES], const int is_covere new_prev.node = node; new_prev.o = o; new_prev.type = STARTED_MOVING; - if (tarrive_node2 < TMIN) { + if (best_node != target_node || tarrive_node2 < TMIN || (tarrive_node2 == TMIN && best_t1 < ct1)) { TMIN = tarrive_node2; + best_node = target_node; best_o = onext; + best_t1 = ct1; } } } } } + //if (agent_aid.inside_poz) assert(best_o >= 0); if (best_o < 0) return false; + if (best_node != target_node && !agent_aid.inside_poz) { + tmp_path_aid.tmax = T; + for (int t = TINIT; t <= T; ++t) { + auto& new_path_elem = tmp_path_aid.p[t]; + new_path_elem.node = agent_aid.poz_node; + new_path_elem.o = agent_aid.poz_o; + new_path_elem.moving_to_node = new_path_elem.moving_to_o = -1; + new_path_elem.num_partial_turns = 0; + new_path_elem.how_i_got_here = OUTSIDE_SRC; + } + return true; + } + + //assert(best_node == target_node); tmp_path_aid.tmax = TMIN; - int ct = TMIN, cnode = target_node, co = best_o; + int ct = TMIN, cnode = best_node, co = best_o; while (1) { assert(can_reach[ct][cnode][co] == can_reach_idx); assert(ct >= can_reach_with_t1[ct][cnode][co]); @@ -1045,6 +1070,25 @@ void UncoverPath(int aid, const Path& path, int covered_by[][MAXNODES], int is_c } } +void CoverPath1(int aid, const Path& path, int covered_by[][MAXNODES], int is_covered[][MAXNODES], int is_covered_idx) { + const auto& agent_aid = agent[aid]; + if (!agent_aid.inside_poz) return; + for (int t = TINIT; t <= T; ++t) { + assert(is_covered[t][agent_aid.poz_node] != is_covered_idx); + is_covered[t][agent_aid.poz_node] = is_covered_idx; + covered_by[t][agent_aid.poz_node] = aid; + } +} + +void UncoverPath1(int aid, const Path& path, int covered_by[][MAXNODES], int is_covered[][MAXNODES], int is_covered_idx) { + const auto& agent_aid = agent[aid]; + if (!agent_aid.inside_poz) return; + for (int t = TINIT; t <= T; ++t) { + assert(is_covered[t][agent_aid.poz_node] == is_covered_idx && covered_by[t][agent_aid.poz_node] == aid); + is_covered[t][agent_aid.poz_node] = 0; + } +} + bool RunConsistencyChecks(Path path[], const int covered_by[][MAXNODES], const int is_covered[][MAXNODES], int is_covered_idx, bool crash_on_error = true) { for (int aid = 0; aid < N; ++aid) { const auto& agent_aid = agent[aid]; @@ -1424,17 +1468,20 @@ void RandomPermutations(int tid, int ntries) { } } } + bool inconsistent = false; for (int idx = 0; idx < N; ++idx) { const auto& aid = perm_tid[idx]; const auto& agent_aid = agent[aid]; if (agent_aid.status == DONE_REMOVED) continue; auto& tmp_path_tid_aid = tmp_path_tid[aid]; UncoverPath(aid, tmp_path_tid_aid, covered_by_tid, is_covered_tid, is_covered_idx_tid); - FindBestPath(aid, covered_by_tid, is_covered_tid, is_covered_idx_tid, can_reach_tid, can_reach_idx_tid, can_reach_with_t1_tid, heap_tid, heap_size_tid, prev_tid, tmp_path_tid, &tmp_path2_tid[aid], tmax_at_poz_node_tid); + if (!FindBestPath(aid, covered_by_tid, is_covered_tid, is_covered_idx_tid, can_reach_tid, can_reach_idx_tid, can_reach_with_t1_tid, heap_tid, heap_size_tid, prev_tid, tmp_path_tid, &tmp_path2_tid[aid], tmax_at_poz_node_tid)) { + //inconsistent = true; + //break; + } CoverPath(aid, tmp_path_tid_aid, covered_by_tid, is_covered_tid, is_covered_idx_tid); } - - if (RunConsistencyChecks(tmp_path_tid, covered_by_tid, is_covered_tid, is_covered_idx_tid, false)) { + if (!inconsistent && RunConsistencyChecks(tmp_path_tid, covered_by_tid, is_covered_tid, is_covered_idx_tid, false)) { int num_done_agents = 0; double cost = 0.0; int max_tmax = 0; @@ -1468,6 +1515,7 @@ void RandomPermutations(int tid, int ntries) { bool any_best_solution_updates; void RegenerateFullPlan() { + ++num_reschedules; any_best_solution_updates = false; updated_best_solution = true; rerun = 0; @@ -1476,7 +1524,6 @@ void RegenerateFullPlan() { while (updated_best_solution && rerun < kMaxReruns) { updated_best_solution = false; - ++num_reschedules; ++rerun; for (int node = 0; node < nnodes; ++node) tend_ongoing_move[node] = TINIT; @@ -2119,7 +2166,7 @@ bool AdjustIPaths() { const bool changed_important_data = MAX_DONE_AGENTS != num_planned || new_max_tmax > max_tmax; if (changed_important_data) { - DBG(0, ">>> [AdjustIPaths] mda=%d/%d minc=%.3lf new_max_tmax=%d/%d\n", MAX_DONE_AGENTS, num_planned, MIN_COST, new_max_tmax, max_tmax); + DBG(0, ">>> [AdjustIPaths] mda=%d/%d minc=%.6lf new_max_tmax=%d/%d\n", MAX_DONE_AGENTS, num_planned, MIN_COST, new_max_tmax, max_tmax); } CheckNonDeadlockPaths(); diff --git a/r2sol.exe b/r2sol.exe index d880c25cf96d662f43da3ac527f2231190ae955f..2cfca4c12a2f7749ec74179eef1cf436a5521965 100755 Binary files a/r2sol.exe and b/r2sol.exe differ diff --git a/run_local.py b/run_local.py index bd6842d0a04ff1899bb96b91e49910e9abee6e77..7bea0246b30c3ba83a7a2b8218f0190edbf601d8 100644 --- a/run_local.py +++ b/run_local.py @@ -26,7 +26,7 @@ def GetTestParams(tid): def ShouldRunTest(tid): #return tid >= 22 - #return tid == 2 + #return tid >= 1 return True DEFAULT_SPEED_RATIO_MAP = {1.: 0.25, @@ -127,7 +127,7 @@ for test_id in range(NUM_TESTS): avg_nda_dif = (total_percentage_num_done_agents - total_base_percentage_num_done_agents) / num_tests print("\n### test_id=%d nda=%d(dif=%d) pnda=%.6f(dif=%.6f) score=%.6f(dif=%.6f) avg_nda=%.6f(dif=%.6f) avg_sc=%.6f(dif=%.6f)\n" % (test_id, num_done_agents, num_done_agents - base_num_done_agents, percentage_num_done_agents, percentage_num_done_agents - base_percentage_num_done_agents, score, score - base_score, avg_nda, avg_nda_dif, total_score / num_tests, (total_score - total_base_score) / num_tests)) - f.write("%d %d% .10f %.10f %.10f %.10f\n" % (test_id, num_done_agents, percentage_num_done_agents, score, avg_nda, avg_nda_dif)) + f.write("%d %d% .10f %.10f %d %.10f %.10f\n" % (test_id, num_done_agents, percentage_num_done_agents, score, num_done_agents - base_num_done_agents, percentage_num_done_agents - base_percentage_num_done_agents, avg_nda_dif)) f.flush() f.close() diff --git a/scores.txt b/scores.txt index d1735f31aeaec212beeaeac3a6b137832cb4c67d..93e592743fcd99193b5b91a8a3e2255834b095c2 100644 --- a/scores.txt +++ b/scores.txt @@ -1,111 +1,71 @@ -0 106 78.5185185185 -52994.1666667134 78.5185185185 2.2222222222 -1 100 71.4285714286 -44207.9166666883 74.9735449735 0.0396825397 -2 49 40.4958677686 -49127.5833333638 63.4809859052 -2.1774017229 -3 80 100.0000000000 -12663.0000000030 72.6107394289 -1.6330512921 -4 99 63.8709677419 -98876.3333331863 70.8627850915 -1.4354732918 -5 124 94.6564885496 -45629.8333333515 74.8284023345 -1.4506806694 -6 133 76.8786127168 -71251.7500000302 75.1212895320 -0.8305586580 -7 90 66.1764705882 -47082.7500000240 74.0031871640 -0.4510035316 -8 88 73.3333333333 -39408.2500000073 73.9287589606 -0.1231142503 -9 63 41.1764705882 -78234.5833333309 70.6535301234 0.1506350832 -10 81 48.2142857143 -93231.6666665908 68.6135988135 -0.4041845564 -11 93 89.4230769231 -18525.5000000024 70.3477219893 0.0301385156 -12 66 60.0000000000 -47917.5833333604 69.5517433747 0.4474005878 -13 115 72.3270440252 -53697.9166667235 69.7499791355 0.4154434030 -14 84 68.2926829268 -61577.3333333941 69.6528260549 0.7671509702 -15 84 44.2105263158 -137849.0833331903 68.0626823212 0.6863092977 -16 47 41.9642857143 -73369.9166666747 66.5274825208 0.5934171541 -17 94 65.2777777778 -59859.8333333889 66.4580544795 0.4061285468 -18 80 43.4782608696 -69422.5000000359 65.2485916579 0.4133574791 -19 75 93.7500000000 -24955.4166666572 66.6736620750 0.8301896052 -20 117 89.3129770992 -42584.0833333417 67.7517246952 0.7179559308 -21 89 74.1666666667 -48544.2500000212 68.0433129667 0.9883518733 -22 58 52.2522522523 -64849.3333333850 52.2522522523 -2.7027027027 -23 133 81.5950920245 -61359.7500000714 66.9236721384 -1.3513513514 -24 77 96.2500000000 -23466.2499999932 76.6991147589 -1.3175675676 -25 77 40.7407407407 -106668.2499998568 67.7095212544 -1.1204508080 -26 96 96.0000000000 -30766.9999999834 73.3676170035 -1.4963606464 -27 107 74.8251748252 -49891.7500000391 73.6105433071 -1.7131676715 -28 159 85.4838709677 -79484.3333333132 75.3067329729 -1.1612097707 -29 116 77.8523489933 -41342.0833333376 75.6249349755 -0.9321659319 -30 63 45.0000000000 -78791.7499999835 72.2221644226 -0.7492268601 -31 72 45.0000000000 -101734.6666665632 69.4999479804 -0.9868041741 -32 96 81.3559322034 -29777.3333333180 70.5777647279 -0.2037202815 -33 111 80.4347826087 -50994.8333333660 71.3991828847 0.5982805632 -34 85 51.8292682927 -85673.4999999486 69.8938048391 0.3177374054 -35 60 31.5789473684 -110669.8333332141 67.1570293055 0.1822599216 -36 80 100.0000000000 -12376.6666666689 69.3465606851 0.1701092601 -37 117 70.9090909091 -58963.6666667266 69.4442188241 0.3488713708 -38 107 55.4404145078 -82089.9999999491 68.6204656290 0.2673925001 -39 56 46.2809917355 -71158.4166666919 67.3793837461 0.4361920904 -40 89 72.9508196721 -45861.3333333560 67.6726172159 0.3269533350 -41 97 59.1463414634 -69539.5000000394 67.2463034282 -0.2076870147 -42 137 90.7284768212 -66168.0833334116 68.3645021612 -0.2293329500 -43 83 69.1666666667 -56323.0833333781 68.4009641842 -0.0673935735 -44 108 90.0000000000 -53023.1666667064 69.3400526979 0.1891597703 -45 96 61.1464968153 -52345.4166667038 68.9986545362 -0.0575753900 -46 100 100.0000000000 -28655.9166666502 70.2387083547 -0.0552723744 -47 59 41.2587412587 -73483.5000000128 69.1240942356 -0.2683159598 -48 109 58.6021505376 -89732.5833332534 68.7343926172 -0.3977650302 -49 99 76.1538461538 -37966.7499999993 68.9993731007 -0.6308118835 -50 86 46.2365591398 -102455.3333332078 68.2144484813 -0.5905206320 -51 157 95.7317073171 -57933.9166667299 69.1316904425 -0.6114870175 -52 102 64.5569620253 -64526.8333334077 68.9841185581 -0.7346771055 -53 100 76.3358778626 -50002.1666667060 69.2138610363 -0.7355734078 -54 80 64.5161290323 -58572.0000000626 69.0715055211 -0.6399695215 -55 85 54.4871794872 -90309.4166665866 68.6425547554 -0.7719764511 -56 32 40.0000000000 -38966.8333333342 67.8241960481 -1.2142056954 -57 112 62.5698324022 -86876.2499999231 67.6782415024 -1.1649594478 -58 43 43.0000000000 -65179.5000000446 67.0112620023 -1.1605010844 -59 55 48.6725663717 -66837.1666667170 66.5286647489 -1.1765382007 -60 80 100.0000000000 -13154.3333333361 67.3869041143 -1.1463705545 -61 45 56.2500000000 -46214.0000000229 67.1084815114 -1.2739612906 -62 65 60.7476635514 -32065.0833333149 66.9533396099 -1.2200944436 -63 50 31.2500000000 -123192.4166665087 66.1032600954 -1.1166398140 -64 98 98.0000000000 -31738.7499999803 66.8450447444 -0.9743923764 -65 115 63.1868131868 -82612.8333332802 66.7619031181 -0.9897096326 -66 121 68.7500000000 -88025.5833332582 66.8060830488 -0.9424635600 -67 125 99.2063492063 -32734.8333333157 67.5104366609 -0.9392284998 -68 65 63.7254901961 -52030.4166667080 67.4299058850 -0.8983855071 -69 104 75.3623188406 -70565.6666667117 67.5951644883 -0.8494759057 -70 91 77.7777777778 -30848.3333333199 67.8029729228 -0.7449252898 -71 58 48.7394957983 -58469.4166667139 67.4217033803 -0.7468335067 -72 75 62.5000000000 -52436.5000000436 67.3251993924 -0.6178106275 -73 67 50.3759398496 -43178.5000000146 66.9992520935 -0.7505219037 -74 56 31.4606741573 -80463.5833333191 66.3287128872 -0.6409614947 -75 100 100.0000000000 -23030.3333333288 66.9522552411 -0.6290918374 -76 104 96.2962962963 -25798.3333333225 67.4857832603 -0.6344888208 -77 127 76.0479041916 -63685.7500000835 67.6386782769 -0.6445444631 -78 100 100.0000000000 -26668.6666666557 68.2064207633 -0.6332366655 -79 99 99.0000000000 -35319.3333333249 68.7373445433 -0.5016291368 -80 53 53.0000000000 -54447.8333333684 68.4706098900 -0.4422794904 -81 90 81.8181818182 -53478.2500000406 68.6930694221 -0.4349081656 -82 72 46.1538461538 -67439.8333333807 68.3235739587 -0.3542182040 -83 89 79.4642857143 -49547.8333333713 68.5032628580 -0.3485050072 -84 104 73.2394366197 -45276.8333333596 68.5784402193 -0.3765077223 -85 75 93.7500000000 -26804.4999999886 68.9717458409 -0.3315622891 -86 76 95.0000000000 -35835.1666666628 69.3721805202 -0.3841536385 -87 54 67.5000000000 -29709.9166666537 69.3438141487 -0.1889391894 -88 63 41.4473684211 -96082.2499999295 68.9274492871 -0.3530477169 -89 144 77.8378378378 -77835.3333333143 69.0584844128 -0.3558049643 -90 108 58.0645161290 -93165.1666665567 68.8991515392 -0.3818155827 -91 109 68.9873417722 -92862.9999998706 68.9004113996 -0.3582778917 -92 165 83.7563451777 -73850.5833333622 69.1096499036 -0.3818297081 -93 112 77.7777777778 -77321.6666666580 69.2300405685 -0.3668814559 -94 109 88.6178861789 -51253.0000000381 69.4956274946 -0.3729927802 -95 117 61.5789473684 -76918.4166666489 69.3886453308 -0.3252780841 -96 112 75.1677852349 -44968.4166666938 69.4657005295 -0.3567352264 -97 84 46.9273743017 -134604.5833331629 69.1691436054 -0.3814444586 -98 81 49.0909090909 -109069.8333332032 68.9083873130 -0.2899105478 -99 74 45.3987730061 -97883.7499999059 68.6069820014 -0.2861937460 -100 80 100.0000000000 -21479.2500000000 69.0043619761 -0.2667482555 -101 105 72.4137931034 -47613.3333333678 69.0469798652 -0.2375518333 -102 91 91.0000000000 -32946.4999999819 69.3180048051 -0.2222734156 -103 82 75.9259259259 -47043.2500000287 69.3985892090 -0.2986052213 -104 128 68.4491978610 -111117.9166664922 69.3871507591 -0.1725927752 -105 181 92.3469387755 -67885.1666667449 69.6604815688 -0.1766119574 -106 116 71.1656441718 -55325.6666667173 69.6781893641 -0.2250574465 -107 135 93.1034482759 -48175.2500000327 69.9505760956 -0.1823442685 -108 135 68.1818181818 -79761.2499999593 69.9302455449 -0.1860535356 -109 60 60.0000000000 -55615.5000000359 69.8174018455 -0.2407574727 -110 69 86.2500000000 -41840.6666666809 70.0020377798 -0.2240073887 +0 107 79.2592592593 -52253.3333333783 79.2592592593 0.7407407407 +1 98 70.0000000000 -43813.6666666879 74.6296296296 -0.3439153439 +2 57 47.1074380165 -46015.0833333573 65.4555657586 1.9745798534 +3 80 100.0000000000 -12641.1666666695 74.0916743189 1.4809348900 +4 97 62.5806451613 -94266.6666665390 71.7894684874 0.9266833959 +5 120 91.6030534351 -49427.9166666963 75.0917326454 0.2633303108 +6 134 77.4566473988 -69347.5833333812 75.4295776101 0.3082880781 +7 77 56.6176470588 -47386.2500000265 73.0780862912 -0.9251008728 +8 78 65.0000000000 -43703.3333333540 72.1805211478 -1.7482378129 +9 66 43.1372549020 -77183.6666666561 69.2761945232 -1.3773356002 +10 86 51.1904761905 -93239.4999999266 67.6320383111 -0.9815605023 +11 94 90.3846153846 -17857.5833333366 69.5280864006 -0.8196355887 +12 65 59.0909090909 -50743.5833333633 68.7252266075 -0.8265167672 +13 121 76.1006289308 -54317.4166667216 69.2520410592 -0.4979380763 +14 73 59.3495934959 -70854.1666666939 68.5918778883 -1.0609481666 +15 78 41.0526315789 -144834.5833332693 66.8706749940 -1.1920073272 +16 39 34.8214285714 -84546.9166666405 64.9854252044 -1.5420573164 +17 90 62.5000000000 -60058.3333333910 64.8473460264 -1.6107084531 +18 86 46.7391304348 -65792.9166667310 63.8942820479 -1.3543096100 +19 70 87.5000000000 -29605.7499999869 65.0745679455 -1.5990941295 +20 117 89.3129770992 -41680.7500000037 66.2287779052 -1.5229467900 +21 86 71.6666666667 -47557.5000000121 66.4759546671 -1.5673582996 +22 59 53.1531531532 -60402.3333333834 65.8967024273 -1.4600426822 +23 140 85.8895705521 -60829.0000000624 66.7297385992 -1.2202709651 +24 78 97.5000000000 -22534.4166666619 67.9605490552 -1.1214601265 +25 73 38.6243386243 -110503.9999998534 66.8322332694 -1.1597271261 +26 100 100.0000000000 -30430.6666666492 68.0606690743 -0.9686261214 +27 114 79.7202797203 -47854.1666666946 68.4770837402 -0.7592071566 +28 157 84.4086021505 -80125.0833333066 69.0264464440 -0.7701058345 +29 115 77.1812080537 -42055.4166666740 69.2982718310 -0.7668070047 +30 65 46.4285714286 -74360.7500000019 68.5605395599 -0.6959883455 +31 73 45.6250000000 -105455.8333332199 67.8438039487 -0.6547074597 +32 94 79.6610169492 -29424.5833333177 68.2019013123 -0.6862289081 +33 108 78.2608695652 -52800.6666667034 68.4977533198 -0.7299843238 +34 94 57.3170731707 -82580.5833332968 68.1783053155 -0.5523332038 +35 55 28.9473684211 -111816.4999998949 67.0885570685 -0.6100900300 +36 80 100.0000000000 -13770.9166666695 67.9780555261 -0.5936011102 +37 115 69.6969696970 -61363.2500000610 68.0232901095 -0.6098779550 +38 111 57.5129533679 -81642.9999999582 67.7537942956 -0.5410980367 +39 45 37.1900826446 -78943.8333333228 66.9897015043 -0.7548433130 +40 88 72.1311475410 -44856.1666666890 67.1151026272 -0.7564245037 +41 98 59.7560975610 -71466.9166666873 66.9398882209 -0.7238963942 +42 137 90.7284768212 -70315.1666667072 67.4931112116 -0.7070615943 +43 73 60.8333333333 -60773.0833333870 67.3417526234 -0.8803859520 +44 103 85.8333333333 -53733.9166667133 67.7526766392 -0.9534144123 +45 106 67.5159235669 -48753.3333333658 67.7475298333 -0.7942222131 +46 100 100.0000000000 -28320.2499999840 68.4337526028 -0.7773238682 +47 64 44.7552447552 -73679.7500000149 67.9404503560 -0.6882857981 +48 112 60.2150537634 -90551.3333332425 67.7827892010 -0.6413227568 +49 101 77.6923076923 -37641.6666666650 67.9809795708 -0.5977270709 +50 87 46.7741935484 -105831.9999998672 67.5651602371 -0.5754650811 +51 160 97.5609756098 -58274.7500000625 68.1420028404 -0.5292202085 +52 109 68.9873417722 -64424.4166667400 68.1579526315 -0.4356428508 +53 104 79.3893129771 -48585.2500000365 68.3659407861 -0.3710302959 +54 83 66.9354838710 -57931.6666667261 68.3399324785 -0.3202960208 +55 90 57.6923076923 -84169.8333332827 68.1497963216 -0.2573420167 +56 41 51.2500000000 -37359.4166666658 67.8533086669 -0.0554588234 +57 113 63.1284916201 -86557.7499999206 67.7718463040 -0.0448705814 +58 46 46.0000000000 -60018.7500000442 67.4028319599 0.0067373946 +59 49 43.3628318584 -69878.8333333615 67.0021652915 -0.0818704705 +60 80 100.0000000000 -13421.6666666696 67.5431134015 -0.0805283317 +61 50 62.5000000000 -44936.7500000187 67.4617728628 0.0215769640 +62 63 58.8785046729 -31723.6666666487 67.3255305105 -0.0084347160 +63 51 31.8750000000 -120561.6666665172 66.7716159713 0.0014627014 +64 95 95.0000000000 -36285.5833333243 67.2058988025 -0.0447136479 +65 115 63.1868131868 -82509.1666666177 67.1450035659 -0.0440361683 +66 115 65.3409090909 -93240.4999998991 67.1180767827 -0.0942608660 +67 126 100.0000000000 -31547.9166666512 67.6016344771 -0.0812033416 +68 66 64.7058823529 -55811.0833333807 67.5596670550 -0.0658178996 +69 107 77.5362318841 -70951.0833333741 67.7021894097 -0.0338217432 +70 88 75.2136752137 -31255.4999999870 67.8079849844 -0.0694595013 diff --git a/tmp-scores.txt b/tmp-scores.txt index 8e791b1108a0ece993743fe6a5c8c6b2173a8032..8c327cec8a541f704b025470e27b65486d5378ac 100644 --- a/tmp-scores.txt +++ b/tmp-scores.txt @@ -1,6 +1,23 @@ -0 107 79.2592592593 -52253.3333333783 79.2592592593 0.7407407407 -1 98 70.0000000000 -43813.6666666879 74.6296296296 -0.3439153439 -2 57 47.1074380165 -46015.0833333573 65.4555657586 1.9745798534 -3 80 100.0000000000 -12641.1666666695 74.0916743189 1.4809348900 -4 97 62.5806451613 -94266.6666665390 71.7894684874 0.9266833959 -5 120 91.6030534351 -49427.9166666963 75.0917326454 0.2633303108 +0 102 75.5555555556 -51384.6666667085 75.5555555556 -3.7037037037 +1 101 72.1428571429 -44279.0833333557 73.8492063492 -0.7804232804 +2 62 51.2396694215 -45595.1666666892 66.3126940400 0.8571282814 +3 80 100.0000000000 -12318.5833333360 74.7345205300 0.6428462110 +4 97 62.5806451613 -94641.2499998699 72.3037454562 0.5142769688 +5 126 96.1832061069 -49405.1666666975 76.2836555647 1.1919229193 +6 139 80.3468208092 -68151.1666667239 76.8641077425 1.4345301323 +7 81 59.5588235294 -49230.0833333614 74.7009472158 1.6228609246 +8 82 68.3333333333 -42990.5833333507 73.9934345622 1.8129134145 +9 61 39.8692810458 -81413.9166666491 70.5810192106 1.3048246874 +10 88 52.3809523810 -89825.7499999358 68.9264676806 1.2944293695 +11 94 90.3846153846 -18878.1666666677 70.7146466559 1.1865602554 +12 66 60.0000000000 -50541.7500000279 69.8904430670 1.1652164595 +13 126 79.2452830189 -51728.7500000456 70.5586459207 1.3066048615 +14 82 66.6666666667 -62608.2500000501 70.2991806371 1.7073027488 +15 75 39.4736842105 -149457.8333333194 68.3725871105 1.5019121165 +16 52 46.4285714286 -74806.8333333342 67.0817626586 2.0963374542 +17 92 63.8888888889 -59564.4166667197 66.9043807825 2.0570347561 +18 83 45.1086956522 -69024.5000000381 65.7572394598 1.8629574120 +19 71 88.7500000000 -29238.3333333200 66.9068774869 1.8323095414 +20 119 90.8396946565 -42166.5833333397 68.0465354473 1.8177575421 +21 87 72.5000000000 -49046.5000000158 68.2489656543 1.7730109872 +22 58 52.2522522523 -62205.1666667190 67.5534563759 1.6567539486