Loading...
Searching...
No Matches
transport_class.Transport Class Reference

Pulic Methods

def __init__ (self, system_directory)
 
def run (self, checkpoint=None, output=None)
 

Public Attributes

 opt
 
 i
 
 j
 
 a
 
 b
 
 d
 
 f
 
 x
 
 z
 

Protected Attributes

 _ws
 
 _dbin1
 
 _dbin2
 
 _job
 
 _dbout1
 

Detailed Description

Definition at line 61 of file transport_class.py.

Constructors

◆ __init__()

def transport_class.Transport.__init__ (   self,
  system_directory 
)

Definition at line 62 of file transport_class.py.

62 def __init__(self, system_directory):
63 self._ws = GamsWorkspace(system_directory=system_directory)
64 self.opt = self._ws.add_options()
65
66 self._dbin1 = self._ws.add_database(in_model_name="dbIn1")
67 self._dbin2 = self._ws.add_database(in_model_name="dbIn2")
68
69 self.opt.solvelink = SolveLink.LoadLibrary
70 self.opt.all_model_types = "Cplex"
71 self.opt.defines["dbOut1"] = "dbOut1"
72
73 self.i = self._dbin1.add_set("i", 1, "canning plants")
74 self.j = self._dbin1.add_set("j", 1, "markets")
75 self.a = self._dbin1.add_parameter_dc(
76 "a", [self.i], "capacity of plant i in cases"
77 )
78 self.b = self._dbin1.add_parameter_dc(
79 "b", [self.j], "demand at market j in cases"
80 )
81 self.d = self._dbin1.add_parameter_dc(
82 "d", [self.i, self.j], "distance in thousands of miles"
83 )
84 self.f = self._dbin2.add_parameter(
85 "f", 0, "freight in dollars per case per thousand miles"
86 )
87 self.x = None
88 self.z = None
89
90 self._job = self._ws.add_job_from_string(GAMS_MODEL)
91

Methods

◆ run()

def transport_class.Transport.run (   self,
  checkpoint = None,
  output = None 
)

Definition at line 92 of file transport_class.py.

92 def run(self, checkpoint=None, output=None):
93 self._job.run(self.opt, checkpoint, output, False, [self._dbin1, self._dbin2])
94
95 self._dbout1 = self._ws.add_database_from_gdx(
96 self.opt.defines["dbOut1"] + ".gdx"
97 )
98 self.x = self._dbout1["x"]
99 self.z = self._dbout1["z"]

References transport_class.Transport._dbin1, transport_class.Transport._dbin2, cutstock_class.Cutstock._job, transport_class.Transport._job, cutstock_class.Cutstock.opt, transport_class.Transport.opt, and transport_class.Transport.run().

Referenced by transport_class.Transport.run().

Member Data Documentation

◆ _dbin1

transport_class.Transport._dbin1
protected

Definition at line 66 of file transport_class.py.

Referenced by transport_class.Transport.run().

◆ _dbin2

transport_class.Transport._dbin2
protected

Definition at line 67 of file transport_class.py.

Referenced by transport_class.Transport.run().

◆ _dbout1

transport_class.Transport._dbout1
protected

Definition at line 95 of file transport_class.py.

◆ _job

transport_class.Transport._job
protected

◆ _ws

transport_class.Transport._ws
protected

Definition at line 63 of file transport_class.py.

Referenced by cutstock_class.Cutstock.run(), and transport14.Optimizer.solve().

◆ a

transport_class.Transport.a

Definition at line 75 of file transport_class.py.

◆ b

transport_class.Transport.b

Definition at line 78 of file transport_class.py.

◆ d

transport_class.Transport.d

Definition at line 81 of file transport_class.py.

◆ f

transport_class.Transport.f

Definition at line 84 of file transport_class.py.

◆ i

transport_class.Transport.i

Definition at line 73 of file transport_class.py.

◆ j

transport_class.Transport.j

Definition at line 74 of file transport_class.py.

◆ opt

transport_class.Transport.opt

◆ x

transport_class.Transport.x

Definition at line 87 of file transport_class.py.

◆ z

transport_class.Transport.z

Definition at line 88 of file transport_class.py.