Skip to content

Commit bf81b4e

Browse files
committed
Sync with ME-projects
1 parent 855a4bc commit bf81b4e

File tree

5 files changed

+15281
-0
lines changed

5 files changed

+15281
-0
lines changed

economic_planning/DynamicModel.lp

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
\ Model EconomicPlanning
2+
\ LP format - for model browsing. Use MPS format to capture full model detail.
3+
Maximize
4+
0.3 production[steel,3] + 0.6 production[coal,1]
5+
+ 0.2 production[transport,3] + 0.3 production[steel,2]
6+
+ 0.6 production[coal,2] + 0.2 production[transport,2]
7+
+ 0.3 production[steel,5] + 0.6 production[coal,3]
8+
+ 0.2 production[transport,1] + 0.3 production[steel,4]
9+
+ 0.6 production[coal,4] + 0.2 production[transport,5]
10+
+ 0.6 production[coal,5] + 0.2 production[transport,4]
11+
+ 0.3 production[steel,1] + 0.2 extra_cap[steel,3]
12+
+ 0.4 extra_cap[coal,1] + 0.1 extra_cap[transport,3]
13+
+ 0.2 extra_cap[steel,2] + 0.4 extra_cap[coal,2]
14+
+ 0.1 extra_cap[transport,2] + 0.2 extra_cap[steel,5]
15+
+ 0.4 extra_cap[coal,3] + 0.1 extra_cap[transport,1]
16+
+ 0.2 extra_cap[steel,4] + 0.4 extra_cap[coal,4]
17+
+ 0.1 extra_cap[transport,5] + 0.4 extra_cap[coal,5]
18+
+ 0.1 extra_cap[transport,4] + 0.2 extra_cap[steel,1]
19+
Subject To
20+
balance1[coal]: 0.5 production[steel,2] + 0.1 production[coal,2]
21+
+ 0.4 production[transport,2] + stock[coal,1] + 0.7 extra_cap[steel,3]
22+
+ 0.9 extra_cap[transport,3] + 0.1 extra_cap[coal,3] = 190
23+
balance1[steel]: 0.1 production[steel,2] + 0.1 production[coal,2]
24+
+ 0.2 production[transport,2] + stock[steel,1] + 0.1 extra_cap[steel,3]
25+
+ 0.2 extra_cap[transport,3] + 0.1 extra_cap[coal,3] = 120
26+
balance1[transport]: 0.1 production[steel,2] + 0.2 production[coal,2]
27+
+ 0.2 production[transport,2] + stock[transport,1]
28+
+ 0.1 extra_cap[steel,3] + 0.2 extra_cap[transport,3]
29+
+ 0.2 extra_cap[coal,3] = 170
30+
balance_t[coal,2]: - 0.5 production[steel,3] - 0.4 production[transport,3]
31+
+ production[coal,2] - 0.1 production[coal,3] + stock[coal,1]
32+
- stock[coal,2] - 0.7 extra_cap[steel,4] - 0.1 extra_cap[coal,4]
33+
- 0.9 extra_cap[transport,4] = 60
34+
balance_t[coal,3]: production[coal,3] - 0.5 production[steel,4]
35+
- 0.1 production[coal,4] - 0.4 production[transport,4] + stock[coal,2]
36+
- stock[coal,3] - 0.7 extra_cap[steel,5] - 0.9 extra_cap[transport,5]
37+
- 0.1 extra_cap[coal,5] = 60
38+
balance_t[coal,4]: - 0.5 production[steel,5] + production[coal,4]
39+
- 0.4 production[transport,5] - 0.1 production[coal,5] + stock[coal,3]
40+
- stock[coal,4] - 0.7 extra_cap[steel,6] - 0.9 extra_cap[transport,6]
41+
- 0.1 extra_cap[coal,6] = 60
42+
balance_t[steel,2]: - 0.1 production[steel,3]
43+
- 0.2 production[transport,3] + production[steel,2]
44+
- 0.1 production[coal,3] - stock[steel,2] + stock[steel,1]
45+
- 0.1 extra_cap[steel,4] - 0.1 extra_cap[coal,4]
46+
- 0.2 extra_cap[transport,4] = 60
47+
balance_t[steel,3]: production[steel,3] - 0.1 production[steel,4]
48+
- 0.1 production[coal,4] - 0.2 production[transport,4] - stock[steel,3]
49+
+ stock[steel,2] - 0.1 extra_cap[steel,5] - 0.2 extra_cap[transport,5]
50+
- 0.1 extra_cap[coal,5] = 60
51+
balance_t[steel,4]: - 0.1 production[steel,5] + production[steel,4]
52+
- 0.2 production[transport,5] - 0.1 production[coal,5] + stock[steel,3]
53+
- stock[steel,4] - 0.1 extra_cap[steel,6] - 0.2 extra_cap[transport,6]
54+
- 0.1 extra_cap[coal,6] = 60
55+
balance_t[transport,2]: - 0.1 production[steel,3]
56+
- 0.2 production[transport,3] + production[transport,2]
57+
- 0.2 production[coal,3] - stock[transport,2] + stock[transport,1]
58+
- 0.1 extra_cap[steel,4] - 0.2 extra_cap[coal,4]
59+
- 0.2 extra_cap[transport,4] = 30
60+
balance_t[transport,3]: production[transport,3] - 0.1 production[steel,4]
61+
- 0.2 production[coal,4] - 0.2 production[transport,4]
62+
- stock[transport,3] + stock[transport,2] - 0.1 extra_cap[steel,5]
63+
- 0.2 extra_cap[transport,5] - 0.2 extra_cap[coal,5] = 30
64+
balance_t[transport,4]: - 0.1 production[steel,5]
65+
- 0.2 production[transport,5] - 0.2 production[coal,5]
66+
+ production[transport,4] + stock[transport,3] - stock[transport,4]
67+
- 0.1 extra_cap[steel,6] - 0.2 extra_cap[transport,6]
68+
- 0.2 extra_cap[coal,6] = 30
69+
balance5[coal]: - 0.5 production[steel,6] - 0.4 production[transport,6]
70+
+ production[coal,5] - 0.1 production[coal,6] + stock[coal,4]
71+
- stock[coal,5] = 60
72+
balance5[steel]: production[steel,5] - 0.1 production[steel,6]
73+
- 0.2 production[transport,6] - 0.1 production[coal,6] - stock[steel,5]
74+
+ stock[steel,4] = 60
75+
balance5[transport]: - 0.1 production[steel,6]
76+
- 0.2 production[transport,6] + production[transport,5]
77+
- 0.2 production[coal,6] - stock[transport,5] + stock[transport,4] = 30
78+
steadyProduction[coal]: production[coal,6] >= 166.3967611336032
79+
steadyProduction[steel]: production[steel,6] >= 105.668016194332
80+
steadyProduction[transport]: production[transport,6] >= 92.30769230769229
81+
capacityConstr[steel,3]: production[steel,3] - extra_cap[steel,3]
82+
- extra_cap[steel,2] - extra_cap[steel,1] <= 350
83+
capacityConstr[coal,1]: production[coal,1] - extra_cap[coal,1] <= 300
84+
capacityConstr[transport,3]: production[transport,3]
85+
- extra_cap[transport,3] - extra_cap[transport,2]
86+
- extra_cap[transport,1] <= 280
87+
capacityConstr[steel,2]: production[steel,2] - extra_cap[steel,2]
88+
- extra_cap[steel,1] <= 350
89+
capacityConstr[coal,2]: production[coal,2] - extra_cap[coal,1]
90+
- extra_cap[coal,2] <= 300
91+
capacityConstr[transport,2]: production[transport,2]
92+
- extra_cap[transport,2] - extra_cap[transport,1] <= 280
93+
capacityConstr[steel,5]: production[steel,5] - extra_cap[steel,3]
94+
- extra_cap[steel,2] - extra_cap[steel,5] - extra_cap[steel,4]
95+
- extra_cap[steel,1] <= 350
96+
capacityConstr[coal,3]: production[coal,3] - extra_cap[coal,1]
97+
- extra_cap[coal,2] - extra_cap[coal,3] <= 300
98+
capacityConstr[transport,1]: production[transport,1]
99+
- extra_cap[transport,1] <= 280
100+
capacityConstr[steel,4]: production[steel,4] - extra_cap[steel,3]
101+
- extra_cap[steel,2] - extra_cap[steel,4] - extra_cap[steel,1] <= 350
102+
capacityConstr[coal,4]: production[coal,4] - extra_cap[coal,1]
103+
- extra_cap[coal,2] - extra_cap[coal,3] - extra_cap[coal,4] <= 300
104+
capacityConstr[transport,5]: production[transport,5]
105+
- extra_cap[transport,3] - extra_cap[transport,2]
106+
- extra_cap[transport,1] - extra_cap[transport,5]
107+
- extra_cap[transport,4] <= 280
108+
capacityConstr[coal,5]: production[coal,5] - extra_cap[coal,1]
109+
- extra_cap[coal,2] - extra_cap[coal,3] - extra_cap[coal,4]
110+
- extra_cap[coal,5] <= 300
111+
capacityConstr[transport,4]: production[transport,4]
112+
- extra_cap[transport,3] - extra_cap[transport,2]
113+
- extra_cap[transport,1] - extra_cap[transport,4] <= 280
114+
capacityConstr[steel,1]: production[steel,1] - extra_cap[steel,1] <= 350
115+
Bounds
116+
production[coal,1] = 0
117+
production[transport,1] = 0
118+
production[steel,1] = 0
119+
extra_cap[coal,1] = 0
120+
extra_cap[steel,2] = 0
121+
extra_cap[coal,2] = 0
122+
extra_cap[transport,2] = 0
123+
extra_cap[transport,1] = 0
124+
extra_cap[steel,6] = 0
125+
extra_cap[transport,6] = 0
126+
extra_cap[coal,6] = 0
127+
extra_cap[steel,1] = 0
128+
End

economic_planning/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Economic Planning
2+
3+
This model is an example of an economic planning problem that a country may face. This problem is an input–output model
4+
representing the interrelationships between the different sectors of a country’s economy. In such problems, the goal
5+
is to determine different possible growth patterns for the economy. The input-output model is formulated as a linear
6+
programming problem using the Gurobi Python API and solved with the Gurobi Optimizer.
7+
8+
This model is example 9 from the fifth edition of Model Building in Mathematical Programming by H. Paul Williams on
9+
pages 263-264 and 316-317.
10+
11+
This modeling example is at the intermediate level, where we assume that you know Python and are familiar with the
12+
Gurobi Python API. In addition, you should have some knowledge about building mathematical optimization models.
13+
14+
https://gurobi.github.io/modeling-examples/economic_planning/economic_planning.html
15+
16+
## Download the Repository
17+
18+
You can download the repository containing this and other examples
19+
by clicking [here](https://github.com/Gurobi/modeling-examples/archive/master.zip).
20+
21+
## Gurobi License
22+
23+
In order to run this Jupyter Notebook properly, you must have a Gurobi license. If you do not have one, you can request
24+
an [evaluation license](https://www.gurobi.com/downloads/request-an-evaluation-license/?utm_source=3PW&utm_medium=OT&utm_campaign=WW-MU-MUI-OR-O_LEA-PR_NO-Q3_FY20_WW_JPME_Economic_Plannng_COM_EVAL_GitHub&utm_term=Economic%20Planning&utm_content=C_JPM)
25+
as a *commercial user*, or download a [free license](https://www.gurobi.com/academia/academic-program-and-licenses/?utm_source=3PW&utm_medium=OT&utm_campaign=WW-MU-MUI-OR-O_LEA-PR_NO-Q3_FY20_WW_JPME_Economic_Plannng_COM_EVAL_GitHub&utm_term=Economic%20Planning&utm_content=C_JPM) as an *academic user*.
26+
27+
Copyright © 2020 Gurobi Optimization, LLC

economic_planning/StaticModel.lp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
\ Model StaticModel
2+
\ LP format - for model browsing. Use MPS format to capture full model detail.
3+
Minimize
4+
5+
Subject To
6+
static_balance[coal]: 0.9 static_prod[coal] - 0.5 static_prod[steel]
7+
- 0.4 static_prod[transport] = 60
8+
static_balance[steel]: - 0.1 static_prod[coal] + 0.9 static_prod[steel]
9+
- 0.2 static_prod[transport] = 60
10+
static_balance[transport]: - 0.2 static_prod[coal]
11+
- 0.1 static_prod[steel] + 0.8 static_prod[transport] = 30
12+
Bounds
13+
End

0 commit comments

Comments
 (0)