Loading...
Searching...
No Matches
cutstock Namespace Reference

Variables

str GAMS_MASTER_MODEL
 
str GAMS_SUB_MODEL
 
sys sys_dir = sys.argv[1] if len(sys.argv) > 1 else None
 
GamsWorkspace ws = GamsWorkspace(system_directory=sys_dir)
 
GamsWorkspace opt = ws.add_options()
 
GamsWorkspace cutstock_data = ws.add_database("csdata")
 
 all_model_types
 
 optcr
 
int max_pattern = 35
 
int r = 100
 
GamsWorkspace raw_width = cutstock_data.add_parameter("r", 0, "raw width")
 
 value
 
dict d = {"i1": 97, "i2": 610, "i3": 395, "i4": 211}
 
GamsWorkspace demand = cutstock_data.add_parameter("d", 1, "demand")
 
GamsWorkspace widths = cutstock_data.add_set("i", 1, "widths")
 
dict w = {"i1": 47, "i2": 36, "i3": 31, "i4": 14}
 
GamsWorkspace width = cutstock_data.add_parameter("w", 1, "width")
 
GamsWorkspace cp_master = ws.add_checkpoint()
 
GamsWorkspace job_master_init = ws.add_job_from_string(GAMS_MASTER_MODEL)
 
 databases
 
GamsWorkspace job_master
 
GamsWorkspace pattern = cutstock_data.add_set("pp", 1, "pattern index")
 
GamsWorkspace pattern_data = cutstock_data.add_parameter("aip", 2, "pattern data")
 
int pattern_count = 0
 
GamsWorkspace cp_sub = ws.add_checkpoint()
 
GamsWorkspace job_sub = ws.add_job_from_string(GAMS_SUB_MODEL)
 
GamsWorkspace mi_sub = cp_sub.add_modelinstance()
 
GamsWorkspace demand_dual
 
 else :
 
GamsWorkspace s = pattern.add_record(str(pattern_count))
 
GamsWorkspace aip = job_master.out_db["aip"].first_record((" ", xp.key(0)))
 

Variable Documentation

◆ aip

GamsWorkspace cutstock.aip = job_master.out_db["aip"].first_record((" ", xp.key(0)))

Definition at line 176 of file cutstock.py.

◆ all_model_types

cutstock.all_model_types

Definition at line 90 of file cutstock.py.

◆ cp_master

cutstock.cp_master = ws.add_checkpoint()

Definition at line 113 of file cutstock.py.

◆ cp_sub

cutstock.cp_sub = ws.add_checkpoint()

Definition at line 132 of file cutstock.py.

◆ cutstock_data

GamsWorkspace cutstock.cutstock_data = ws.add_database("csdata")

Definition at line 89 of file cutstock.py.

◆ d

dict cutstock.d = {"i1": 97, "i2": 610, "i3": 395, "i4": 211}

Definition at line 101 of file cutstock.py.

◆ databases

cutstock.databases

Definition at line 115 of file cutstock.py.

◆ demand

GamsWorkspace cutstock.demand = cutstock_data.add_parameter("d", 1, "demand")

Definition at line 102 of file cutstock.py.

◆ demand_dual

GamsWorkspace cutstock.demand_dual
Initial value:
1= mi_sub.sync_db.add_parameter(
2 "demdual", 1, "dual of demand from master"
3 )

Definition at line 138 of file cutstock.py.

◆ else

cutstock.else :

Definition at line 157 of file cutstock.py.

◆ GAMS_MASTER_MODEL

str cutstock.GAMS_MASTER_MODEL

Definition at line 14 of file cutstock.py.

◆ GAMS_SUB_MODEL

str cutstock.GAMS_SUB_MODEL
Initial value:
1= """
2Set i 'widths';
3
4Parameter w(i) 'width';
5Scalar r 'raw width';
6
7$gdxIn csdata
8$load i w r
9$gdxIn
10
11Parameter
12 demdual(i) 'duals of master demand constraint' / #i eps /;
13
14Variable
15 z
16 y(i) 'new pattern';
17Integer Variable y;
18y.up(i) = ceil(r/w(i));
19
20Equation
21 defobj
22 knapsack;
23
24defobj.. z =e= 1 - sum(i, demdual(i)*y(i));
25
26knapsack.. sum(i, w(i)*y(i)) =l= r;
27
28Model pricing / defobj, knapsack /;
29"""

Definition at line 54 of file cutstock.py.

◆ job_master

GamsWorkspace cutstock.job_master
Initial value:
1= ws.add_job_from_string(
2 "execute_load 'csdata', aip, pp; solve master min z using %solveMasterAs%;",
3 cp_master,
4 )

Definition at line 116 of file cutstock.py.

◆ job_master_init

GamsWorkspace cutstock.job_master_init = ws.add_job_from_string(GAMS_MASTER_MODEL)

Definition at line 114 of file cutstock.py.

◆ job_sub

GamsWorkspace cutstock.job_sub = ws.add_job_from_string(GAMS_SUB_MODEL)

Definition at line 133 of file cutstock.py.

◆ max_pattern

int cutstock.max_pattern = 35

Definition at line 92 of file cutstock.py.

◆ mi_sub

GamsWorkspace cutstock.mi_sub = cp_sub.add_modelinstance()

Definition at line 135 of file cutstock.py.

◆ opt

cutstock.opt = ws.add_options()

Definition at line 88 of file cutstock.py.

◆ optcr

cutstock.optcr

Definition at line 91 of file cutstock.py.

◆ pattern

GamsWorkspace cutstock.pattern = cutstock_data.add_set("pp", 1, "pattern index")

Definition at line 121 of file cutstock.py.

◆ pattern_count

int cutstock.pattern_count = 0

Definition at line 125 of file cutstock.py.

◆ pattern_data

GamsWorkspace cutstock.pattern_data = cutstock_data.add_parameter("aip", 2, "pattern data")

Definition at line 122 of file cutstock.py.

◆ r

int cutstock.r = 100

Definition at line 97 of file cutstock.py.

◆ raw_width

GamsWorkspace cutstock.raw_width = cutstock_data.add_parameter("r", 0, "raw width")

Definition at line 98 of file cutstock.py.

◆ s

GamsWorkspace cutstock.s = pattern.add_record(str(pattern_count))

Definition at line 160 of file cutstock.py.

◆ sys_dir

sys cutstock.sys_dir = sys.argv[1] if len(sys.argv) > 1 else None

Definition at line 85 of file cutstock.py.

◆ value

cutstock.value

Definition at line 99 of file cutstock.py.

◆ w

dict cutstock.w = {"i1": 47, "i2": 36, "i3": 31, "i4": 14}

Definition at line 108 of file cutstock.py.

◆ width

GamsWorkspace cutstock.width = cutstock_data.add_parameter("w", 1, "width")

Definition at line 109 of file cutstock.py.

◆ widths

GamsWorkspace cutstock.widths = cutstock_data.add_set("i", 1, "widths")

Definition at line 103 of file cutstock.py.

◆ ws

GamsWorkspace cutstock.ws = GamsWorkspace(system_directory=sys_dir)

Definition at line 86 of file cutstock.py.