Mercurial > hg > problem6
changeset 19:6015c8cfe502 draft
showplan: new debug function
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Tue, 17 Mar 2015 09:48:03 -0400 |
parents | a626b8be6694 |
children | 7413c98553c3 |
files | optim.py |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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