From 938edc8728ba5254dd6d5bbe29e6308dddf48577 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Thu, 9 Mar 2017 09:16:16 +0100 Subject: Add slot/worker assignment export switch --- ilpscheduling/scheduler.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'ilpscheduling') diff --git a/ilpscheduling/scheduler.py b/ilpscheduling/scheduler.py index c854be5..1498bf1 100644 --- a/ilpscheduling/scheduler.py +++ b/ilpscheduling/scheduler.py @@ -146,12 +146,21 @@ def mainOptimize (args): hdr = [] for s in data.slotNames: if groupSize[s].X > 0: - hdr.append ('{} ({})'.format (s, groupSize[s].X)) + hdr.append ('{} ({})'.format (s, int (groupSize[s].X))) print (tabulate (tbl, headers=hdr)) + if args.output: + for s in data.slotNames: + if groupSize[s].X > 0: + with open (os.path.join (args.output, s + '.txt'), 'w') as fd: + for w in data.workerNames: + if x[w,s].X == 1: + fd.write ('{}\n'.format (w)) + def addParser (subparsers): parser = subparsers.add_parser ('optimize', help='Optimize schedule') + parser.add_argument('-o', '--output', help='Output directory for mapping files') parser.add_argument('file', help='input file') parser.set_defaults (func=mainOptimize) -- cgit v1.2.3