11from cutstock_class
import Cutstock
12from gams
import GamsException
14if __name__ ==
"__main__":
15 sys_dir = sys.argv[1]
if len(sys.argv) > 1
else None
19 cs.raw_width.add_record().value = r
21 d = {
"i1": 97,
"i2": 610,
"i3": 395,
"i4": 211}
23 cs.widths.add_record(i)
24 for k, v
in d.items():
25 cs.demand.add_record(k).value = v
27 w = {
"i1": 47,
"i2": 36,
"i3": 31,
"i4": 14}
28 for k, v
in w.items():
29 cs.width.add_record(k).value = v
30 cs.opt.all_model_types =
"cplex"
33 cs.run(output=sys.stdout)
34 for rep
in cs.pat_rep:
35 print(f
"{rep.key(0)}, pattern {rep.key(1)}: {rep.value}")
36 except GamsException
as e:
37 raise Exception(f
"Error in GAMS: {e}")
38 except Exception
as e:
39 raise Exception(f
"System Error: {e}")