aboutsummaryrefslogtreecommitdiffstats
path: root/planning
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.no>2018-03-22 01:51:11 +0100
committerKristian Lyngstol <kly@kly.no>2018-03-22 01:51:11 +0100
commit978d35afe80d701fef89519355969794dcb363ac (patch)
tree1c78462e2dfb8e3be99cb9e80d7c96b45f3f14e2 /planning
parent4b11137a1854a317821b60686030fa40815c5ad0 (diff)
Start TG18 planning
Diffstat (limited to 'planning')
-rw-r--r--planning/planning.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/planning/planning.cpp b/planning/planning.cpp
index e17731b..324a7b4 100644
--- a/planning/planning.cpp
+++ b/planning/planning.cpp
@@ -5,11 +5,15 @@
// Given D distro switches and N access switches, complexity is approx. O(dn³)
// (runs n iterations, each iteration is O(VE), V is O(n), E is O(dn))).
//
-// g++ -std=gnu++11 -Wall -g -O3 -fopenmp -DOUTPUT_FILES=1 -o planning planning.cpp && ./planning -5 6 14 23 -24 35 -34
-// TG18: -5 6 14 23 -24 35 -34
+// g++ -std=gnu++11 -Wall -g -O3 -fopenmp -DOUTPUT_FILES=1 -o planning planning.cpp && ./planning -4 6 14 -23 24 -30 30 35 -35
+//
+// TG18: -4 6 14 -23 24 -30 32 37 -38
+// -4 6 14 -23 24 -30 30 35 -35
+//
+//
//
// Full one-liner:
-// rm planning ; g++ -std=gnu++11 -Wall -g -O3 -fopenmp -DOUTPUT_FILES=1 -o planning planning.cpp && ./planning -5 6 14 23 -24 35 -34 ; sort -k 2,2 -k 1,1V patchlist.txt > patchlist.txt.distrosort ; cp patchlist.txt* switches.txt ../
+// rm planning ; g++ -std=gnu++11 -Wall -g -O3 -fopenmp -DOUTPUT_FILES=1 -o planning planning.cpp && ./planning -4 6 14 -23 24 -30 30 35 -35 ; sort -k 2,2 -k 1,1V patchlist.txt > patchlist.txt.distrosort ; cp patchlist.txt* switches.txt ../
#include <stdio.h>
@@ -30,8 +34,8 @@
#include <string>
#include <queue>
-#define NUM_DISTRO 7
-#define NUM_ROWS 41
+#define NUM_DISTRO 9
+#define NUM_ROWS 38
#define SWITCHES_PER_ROW 4
#define PORTS_PER_DISTRO 31
@@ -293,7 +297,7 @@ unsigned Planner::find_cost(Switch from_where, int distro)
Inventory inv = find_inventory(from_where, distro);
unsigned cost;
-#if TRUNCATE_METRIC
+#if !TRUNCATE_METRIC
cost = 100 * inv.num_10m + 300 * inv.num_30m + 500 * inv.num_50m + EXTENSION_COST * inv.extensions;
// cost = find_slack(inv, distance);
#else
@@ -362,7 +366,6 @@ void Planner::init_switches()
switches.push_back(Switch(i, 3));
}
if (i == 2) {
- switches.push_back(Switch(i,1));
switches.push_back(Switch(i,2));
switches.push_back(Switch(i,3));
}