Commit 648543be authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

only attempt planning when it isn't already complete (#64)

parent 3dc49d8c
......@@ -4,6 +4,7 @@
planning_time: 248.04648566246033
print_time: '2136.9092555822976'
total_time: '2051.5132172082695'
status: SUCCESS
zoneblocking:
planning_time: 0.003212451934814453
print_time: '0'
......@@ -13,11 +14,13 @@ Base_145x145mm_12holes-ascii:
planning_time: 548.0587134361267
print_time: '2966.8706351401556'
total_time: '3363.827501695836'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 120.92579364776611
print_time: '2966.8706351401565'
total_time: '2201.992079388948'
status: SUCCESS
zoneblocking:
planning_time: 0.0038437843322753906
print_time: '0'
......@@ -27,11 +30,13 @@ Ernesto_Che_Guevara_in_style_Voronoi-ascii:
planning_time: 527.0104742050171
print_time: '833.6113303658677'
total_time: '1071.2417581387417'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 30.65012264251709
print_time: '833.6113303658678'
total_time: '619.4171475591089'
status: SUCCESS
zoneblocking:
planning_time: 0.012465715408325195
print_time: '0'
......@@ -41,11 +46,13 @@ Kitchen_sponge_holder_small-ascii:
planning_time: 236.77037978172302
print_time: '2104.703480845539'
total_time: '1424.9319627538457'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 22.5665500164032
print_time: '2104.7034808455387'
total_time: '1215.5888389663821'
status: SUCCESS
zoneblocking:
planning_time: 0.03427886962890625
print_time: '0'
......@@ -55,11 +62,13 @@ NEW_CORNER-ascii:
planning_time: 167.83609342575073
print_time: '2233.381019803894'
total_time: '1638.843469361648'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 90.48921990394592
print_time: '2233.381019803894'
total_time: '1552.5939874430694'
status: SUCCESS
zoneblocking:
planning_time: 0.003814697265625
print_time: '0'
......@@ -69,11 +78,13 @@ Skulptur_012-ascii:
planning_time: 42.90529799461365
print_time: '985.3570314532824'
total_time: '1002.147347413597'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 11.972369194030762
print_time: '985.3570314532824'
total_time: '863.3641296420471'
status: SUCCESS
zoneblocking:
planning_time: 0.0028841495513916016
print_time: '0'
......@@ -83,11 +94,13 @@ Top-ascii:
planning_time: 891.8765835762024
print_time: '8813.311742799962'
total_time: '8809.754545722297'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 1362.249165058136
print_time: '8813.31174279997'
total_time: '7916.28202146605'
status: SUCCESS
zoneblocking:
planning_time: 0.007516384124755859
print_time: '0'
......@@ -98,6 +111,7 @@ V1_Front:
planning_time: 90.4068763256073
print_time: '2344.1503161556925'
total_time: '1620.1571740712243'
status: SUCCESS
zoneblocking:
planning_time: 0.00390934944152832
print_time: '0'
......@@ -107,6 +121,7 @@ bp_FJ6309_BP23248_FMA52740_Ethmoid_fixed-ascii:
planning_time: 212.0136787891388
print_time: '2925.450465906622'
total_time: '2916.9510378911314'
status: SUCCESS
every_nth_layer: 50
zoneblocking:
planning_time: 30.25228714942932
......@@ -117,11 +132,13 @@ entrapment2:
planning_time: 168.0334358215332
print_time: '3378.7917379336404'
total_time: '3363.420773394101'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 104.99572253227234
print_time: '3378.791737933641'
total_time: '3182.7980704020647'
status: SUCCESS
zoneblocking:
planning_time: 0.0031876564025878906
print_time: '0'
......@@ -131,17 +148,20 @@ finalraptornormaltail-ascii:
planning_time: 2933.117799282074
print_time: '1992.8125034954408'
total_time: '2447.053348017768'
status: SUCCESS
every_nth_layer: 50
flexirex:
decmcts:
planning_time: 53.9430136680603
print_time: '37.47601253665581'
total_time: '283.19687529327655'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 1.7581582069396973
print_time: '37.476012536655816'
total_time: '65.72601253665582'
status: SUCCESS
zoneblocking:
planning_time: 0.0001842975616455078
print_time: '0'
......@@ -151,11 +171,13 @@ four_screws-ascii:
planning_time: 117.03365349769592
print_time: '1831.6863341746734'
total_time: '1117.7038705612551'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 16.286158561706543
print_time: '1831.6863341746734'
total_time: '1039.9559788119368'
status: SUCCESS
zoneblocking:
planning_time: 0.002079010009765625
print_time: '0'
......@@ -165,11 +187,13 @@ ir_sensor_main-ascii:
planning_time: 79.03400754928589
print_time: '518.5028907346898'
total_time: '598.8999752632523'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 16.25504493713379
print_time: '518.5028907346897'
total_time: '448.2154426902397'
status: SUCCESS
zoneblocking:
planning_time: 0.004309415817260742
print_time: '0'
......@@ -179,11 +203,13 @@ mano_derch_right_hand-ascii:
planning_time: 88.75551390647888
print_time: '958.2469613347561'
total_time: '1191.717097001031'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 24.48207449913025
print_time: '958.246961334756'
total_time: '904.2945788146496'
status: SUCCESS
zoneblocking:
planning_time: 0.003360748291015625
print_time: '0'
......@@ -193,11 +219,13 @@ orb_half_2-ascii:
planning_time: 126.77951121330261
print_time: '813.9754004625381'
total_time: '877.4578488117623'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 19.499476194381714
print_time: '813.9754004625377'
total_time: '658.1790553842529'
status: SUCCESS
zoneblocking:
planning_time: 0.0033457279205322266
print_time: '0'
......@@ -207,11 +235,13 @@ plannet_X_3:
planning_time: 222.9321804046631
print_time: '3418.2151444390934'
total_time: '2847.2670296235856'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 55.38108253479004
print_time: '3418.2151444390934'
total_time: '2796.8368568476335'
status: SUCCESS
zoneblocking:
planning_time: 0.0030307769775390625
print_time: '0'
......@@ -221,11 +251,13 @@ prop_v2-ascii:
planning_time: 42.42523384094238
print_time: '1267.0852092997638'
total_time: '1324.060866236847'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 59.17121195793152
print_time: '1267.085209299764'
total_time: '1124.6786140474878'
status: SUCCESS
zoneblocking:
planning_time: 0.001992940902709961
print_time: '0'
......@@ -235,11 +267,13 @@ repaird_version._if_given_instructions_give_errors_3D_printed_Marble_Machine_2-a
planning_time: 427.7868263721466
print_time: '3483.8261925645993'
total_time: '3409.186365297655'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 418.75658798217773
print_time: '3483.826192564599'
total_time: '3345.9120293207325'
status: SUCCESS
zoneblocking:
planning_time: 0.00764775276184082
print_time: '0'
......@@ -250,6 +284,7 @@ wind_wheel:
planning_time: 15.675064086914062
print_time: '272.8295447311675'
total_time: '273.34183176233523'
status: SUCCESS
zoneblocking:
planning_time: 0.0004963874816894531
print_time: '0'
......@@ -259,11 +294,13 @@ zaa-ascii:
planning_time: 56.70115375518799
print_time: '356.03091192865287'
total_time: '468.734290845722'
status: SUCCESS
every_nth_layer: 50
greedy:
planning_time: 7.776453256607056
print_time: '356.03091192865287'
total_time: '282.40230339583184'
status: SUCCESS
zoneblocking:
planning_time: 0.0011951923370361328
print_time: '0'
......
......@@ -20,11 +20,14 @@ def batch_run(
plan_save_dir,
nth_layer,
mcts_nodes_per_layer,
retries=3):
retries=3,
only_complete=True):
"""
runs various planning algos on multiple gcode files
"""
notes = open(output_notes_file, 'a')
with open(output_stats_file, 'r') as f:
prev_stats = yaml.load(f)
stat_file = open(output_stats_file, 'w')
# create one env for all runs
......@@ -45,84 +48,109 @@ def batch_run(
stats[model] = {}
stats[model]['every_nth_layer'] = nth_layer
notes.write("Running Dec-MCTS planner\n")
r = retries
while r:
try:
s_time = time.time()
plan = decmcts.decmcts(
env,
tracker,
nth_layer=nth_layer,
nodes_per_layer=mcts_nodes_per_layer
)
e_time = time.time()
notes.write("Dec-MCTS plan successfully created, saving plan and stats\n")
plan.save(plan_save_dir + "/" + model + "_decmcts.plan")
stats[model]['decmcts'] = \
{'total_time': str(plan.len()),
'print_time': str(plan.extrusion_time()),
'planning_time': e_time - s_time,
'status': 'SUCCESS'}
r = False
except:
stats[model]['decmcts'] = {'status': 'FAILED'}
notes.write("FAILED TO COMPLETE DEC_MCTS ON MODEL {}\n".format(model))
r-=1
notes.write("Running Greedy planner\n")
r = retries
while r:
try:
s_time = time.time()
plan = greedy.greedy(
env,
tracker,
nth_layer=nth_layer
)
e_time = time.time()
notes.write("Greedy plan successfully created, saving plan and stats\n")
plan.save(plan_save_dir + "/" + model + "_greedy.plan")
stats[model]['greedy'] = \
{'total_time': str(plan.len()),
'print_time': str(plan.extrusion_time()),
'planning_time': e_time - s_time,
'status': 'SUCCESS'}
r = False
except:
stats[model]['greedy'] = {'status': 'FAILED'}
notes.write("FAILED TO COMPLETE GREEDY ON MODEL {}\n".format(model))
r-=1
notes.write("Running Zone Blocking planner\n")
r = retries
while r:
try:
s_time = time.time()
plan = zoneblocking.zoneblocking(
env,
tracker,
nth_layer=nth_layer
)
e_time = time.time()
notes.write("Zone blocking plan successfully created, saving plan and stats\n")
plan.save(plan_save_dir + "/" + model + "_zoneblocking.plan")
stats[model]['zoneblocking'] = \
{'total_time': str(plan.len()),
'print_time': str(plan.extrusion_time()),
'planning_time': e_time - s_time,
'status': 'SUCCESS'}
r = False
except:
stats[model]['zoneblocking'] = {'status': 'FAILED'}
notes.write("FAILED TO COMPLETE ZONE BLOCKING ON MODEL {}\n".format(model))
r-=1
if not only_complete or \
model not in prev_stats or \
'decmcts' not in prev_stats[model] or \
'status' not in prev_stats[model]['decmcts'] or \
prev_stats[model]['decmcts']['status'] != 'SUCCESS':
notes.write("Running Dec-MCTS planner\n")
r = retries
while r:
try:
s_time = time.time()
plan = decmcts.decmcts(
env,
tracker,
nth_layer=nth_layer,
nodes_per_layer=mcts_nodes_per_layer
)
e_time = time.time()
notes.write("Dec-MCTS plan successfully created, saving plan and stats\n")
plan.save(plan_save_dir + "/" + model + "_decmcts.plan")
stats[model]['decmcts'] = \
{'total_time': str(plan.len()),
'print_time': str(plan.extrusion_time()),
'planning_time': e_time - s_time,
'status': 'SUCCESS'}
r = False
except:
stats[model]['decmcts'] = {'status': 'FAILED'}
notes.write("FAILED TO COMPLETE DEC_MCTS ON MODEL {}\n".format(model))
r-=1
else:
notes.write("SKIPPING DECMCTS: Already completed successfully")
if not only_complete or \
model not in prev_stats or \
'greedy' not in prev_stats[model] or \
'status' not in prev_stats[model]['greedy'] or \
prev_stats[model]['greedy']['status'] != 'SUCCESS':
notes.write("Running Greedy planner\n")
r = retries
while r:
try:
s_time = time.time()
plan = greedy.greedy(
env,
tracker,
nth_layer=nth_layer
)
e_time = time.time()
notes.write("Greedy plan successfully created, saving plan and stats\n")
plan.save(plan_save_dir + "/" + model + "_greedy.plan")
stats[model]['greedy'] = \
{'total_time': str(plan.len()),
'print_time': str(plan.extrusion_time()),
'planning_time': e_time - s_time,
'status': 'SUCCESS'}
r = False
except:
stats[model]['greedy'] = {'status': 'FAILED'}
notes.write("FAILED TO COMPLETE GREEDY ON MODEL {}\n".format(model))
r-=1
else:
notes.write("SKIPPING GREEDY: Already completed successfully")
if not only_complete or \
model not in prev_stats or \
'zoneblocking' not in prev_stats[model] or \
'status' not in prev_stats[model]['zoneblocking'] or \
prev_stats[model]['zoneblocking']['status'] != 'SUCCESS':
notes.write("Running Zone Blocking planner\n")
r = retries
while r:
try:
s_time = time.time()
plan = zoneblocking.zoneblocking(
env,
tracker,
nth_layer=nth_layer
)
e_time = time.time()
notes.write("Zone blocking plan successfully created, saving plan and stats\n")
plan.save(plan_save_dir + "/" + model + "_zoneblocking.plan")
stats[model]['zoneblocking'] = \
{'total_time': str(plan.len()),
'print_time': str(plan.extrusion_time()),
'planning_time': e_time - s_time,
'status': 'SUCCESS'}
r = False
except:
stats[model]['zoneblocking'] = {'status': 'FAILED'}
notes.write("FAILED TO COMPLETE ZONE BLOCKING ON MODEL {}\n".format(model))
r-=1
else:
notes.write("SKIPPING ZONEBLOCKING: Already completed successfully")
stat_file.write(yaml.dump(stats))
notes.close()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment