# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1426600083 14400 # Node ID 6015c8cfe502750d690696d6e8df6e0d6261366f # Parent a626b8be6694bfad31948345f3ee61c65844c087 showplan: new debug function diff --git a/optim.py b/optim.py --- a/optim.py +++ b/optim.py @@ -112,6 +112,21 @@ return capital + +def showplan(plan, machines): + print + empty = True + for (action, machine) in sorted(zip(plan, machines), + key = lambda x: x[1].day): + if action: + empty = False + print "\t", machine + if empty: + print "\t(do nothing)" + + print + + def brute_force(case): """Form all possible plans, and just try them all.""" machines = case.machines