# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1426106895 14400 # Node ID 4c23cfdeaa5f21fcf63311b002b5ebe66862f322 # Parent d9aa5e25859c2ccf3a1c7c6bf707daf70f795676 main: enable some debug output Also fix the default plan for brute_force() so that it is always iterable, even when it's not set. diff --git a/optim.py b/optim.py --- a/optim.py +++ b/optim.py @@ -125,7 +125,7 @@ plans = [] maxcapital = case.capital - maxplan = None + maxplan = [] for plan in plans: try: plancapital = final_capital(case, machines, plan) @@ -174,6 +174,11 @@ solver = brute_force maxcapital, plan = solver(case) print "Case %d: %d" % (number + 1, maxcapital) + if args.debug: + for (action, machine) in zip(plan, case.machines): + if action: + print "Buy ", machine + print if __name__ == "__main__": main()