8from gams
import GamsWorkspace
9from transport_class
import Transport
11plants = [
"Seattle",
"San-Diego"]
12markets = [
"New-York",
"Chicago",
"Topeka"]
13capacity = {
"Seattle": 350.0,
"San-Diego": 600.0}
14demand = {
"New-York": 325.0,
"Chicago": 300.0,
"Topeka": 275.0}
16 (
"Seattle",
"New-York"): 2.5,
17 (
"Seattle",
"Chicago"): 1.7,
18 (
"Seattle",
"Topeka"): 1.8,
19 (
"San-Diego",
"New-York"): 2.5,
20 (
"San-Diego",
"Chicago"): 1.8,
21 (
"San-Diego",
"Topeka"): 1.4,
24if __name__ ==
"__main__":
25 sys_dir = sys.argv[1]
if len(sys.argv) > 1
else None
33 t.a.add_record(p).value = capacity[p]
35 t.b.add_record(m).value = demand[m]
36 for k, v
in iter(distance.items()):
37 t.d.add_record(k).value = v
39 t.f.add_record().value = 90
40 t.opt.all_model_types =
"cplex"
41 t.run(output=sys.stdout)
43 print(f
"Objective: {t.z.first_record().level}")