The following PROC OPTMODEL statements declare index sets and parameters and then read the input data:
proc optmodel; num num_years = &num_years; set YEARS = 1..num_years; set YEARS0 = {0} union YEARS; set <str> INDUSTRIES; num init_stocks {INDUSTRIES}; num init_productive_capacity {INDUSTRIES}; num demand {INDUSTRIES}; read data industry_data into INDUSTRIES=[industry] init_stocks init_productive_capacity demand; set <str> INPUTS; num production_coeff {INPUTS, INDUSTRIES}; read data production_data into INPUTS=[input] {j in INDUSTRIES} <production_coeff[input,j]=col(j)>; num productive_capacity_coeff {INPUTS, INDUSTRIES}; read data productive_capacity_data into INPUTS=[input] {j in INDUSTRIES} <productive_capacity_coeff[input,j]=col(j)>;
The following PROC OPTMODEL statements declare variables, a constant objective, and constraints for the static Leontief input-output model that is described on page 282 of Williams (1999):
var StaticProduction {INDUSTRIES} >= 0; min Zero = 0; con Static_con {i in INDUSTRIES}: StaticProduction[i] = demand[i] + sum {j in INDUSTRIES} production_coeff[i,j] * StaticProduction[j];
The following SOLVE statement invokes the linear programming solver to solve this system of equations:
solve; print StaticProduction;
Figure 9.1 shows the output from the linear programming solver for the static model.
Figure 9.1: Output from Linear Programming Solver for Static Leontief Input-Output Model
Problem Summary | |
---|---|
Objective Sense | Minimization |
Objective Function | Zero |
Objective Type | Constant |
Number of Variables | 3 |
Bounded Above | 0 |
Bounded Below | 3 |
Bounded Below and Above | 0 |
Free | 0 |
Fixed | 0 |
Number of Constraints | 3 |
Linear LE (<=) | 0 |
Linear EQ (=) | 3 |
Linear GE (>=) | 0 |
Linear Range | 0 |
Constraint Coefficients | 9 |
The following NUM and assignment statements declare the final_demand parameter and use the .sol
variable suffix to populate final_demand with the solution from the static model:
num final_demand {INDUSTRIES}; for {i in INDUSTRIES} final_demand[i] = StaticProduction[i].sol;
The following statements declare variables, implicit variables, objectives, and constraints to be used in all three parts of the business problem:
var Production {INDUSTRIES, 0..num_years+1} >= 0; var Stock {INDUSTRIES, 0..num_years+1} >= 0; var ExtraCapacity {INDUSTRIES, 1..num_years+2} >= 0; impvar ProductiveCapacity {i in INDUSTRIES, year in 1..num_years+1} = init_productive_capacity[i] + sum {y in 2..year} ExtraCapacity[i,y]; for {i in INDUSTRIES} do; Production[i,0].ub = 0; Stock[i,0].lb = init_stocks[i]; Stock[i,0].ub = init_stocks[i]; end; max TotalProductiveCapacity = sum {i in INDUSTRIES} ProductiveCapacity[i,num_years]; max TotalProduction = sum {i in INDUSTRIES, year in 4..5} Production[i,year]; max TotalManpower = sum {i in INDUSTRIES, year in YEARS} ( production_coeff['manpower',i] * Production[i,year+1] + productive_capacity_coeff['manpower',i] * ExtraCapacity[i,year+2]); con Continuity_con {i in INDUSTRIES, year in YEARS0}: Stock[i,year] + Production[i,year] = (if year in YEARS then demand[i] else 0) + sum {j in INDUSTRIES} ( production_coeff[i,j] * Production[j,year+1] + productive_capacity_coeff[i,j] * ExtraCapacity[j,year+2]) + Stock[i,year+1]; con Manpower_con {year in 1..num_years+1}: sum {j in INDUSTRIES} ( production_coeff['manpower',j] * Production[j,year] + productive_capacity_coeff['manpower',j] * ExtraCapacity[j,year+1]) <= &manpower_capacity; con Capacity_con {i in INDUSTRIES, year in 1..num_years+1}: Production[i,year] <= ProductiveCapacity[i,year]; for {i in INDUSTRIES} Production[i,num_years+1].lb = final_demand[i]; for {i in INDUSTRIES, year in num_years+1..num_years+2} ExtraCapacity[i,year].ub = 0;
The following PROBLEM statement specifies the variables, objective, and constraints for Problem1:
problem Problem1 include Production Stock ExtraCapacity TotalProductiveCapacity Continuity_con Manpower_con Capacity_con;
Because Problem1 and Problem2 have the same variables and constraints, the following PROBLEM statement uses the FROM option to copy these common parts from Problem1 and uses the INCLUDE option to specify only the new objective:
problem Problem2 from Problem1 include TotalProduction;
The following PROBLEM statement specifies the variables, objective, and constraints for Problem3 (omitting the Manpower_con constraint):
problem Problem3 include Production Stock ExtraCapacity TotalManpower Continuity_con Capacity_con;
Note that implicit variables are not included in the PROBLEM statements. Including them would yield an ERROR message.
The following USE PROBLEM statement switches the focus to the desired problem:
use problem Problem1; solve; print Production Stock ExtraCapacity ProductiveCapacity Manpower_con.body;
Figure 9.2 shows the output from the linear programming solver for Problem1.
Figure 9.2: Output from Linear Programming Solver for Problem1
Problem Summary | |
---|---|
Objective Sense | Maximization |
Objective Function | TotalProductiveCapacity |
Objective Type | Linear |
Number of Variables | 63 |
Bounded Above | 0 |
Bounded Below | 51 |
Bounded Below and Above | 0 |
Free | 0 |
Fixed | 12 |
Number of Constraints | 42 |
Linear LE (<=) | 24 |
Linear EQ (=) | 18 |
Linear GE (>=) | 0 |
Linear Range | 0 |
Constraint Coefficients | 255 |
[1] | [2] | Production | Stock | ExtraCapacity | ProductiveCapacity |
---|---|---|---|---|---|
coal | 0 | 0.000 | 150.0000 | ||
coal | 1 | 260.403 | 0.0000 | 0.0 | 300.0 |
coal | 2 | 293.406 | 0.0000 | 0.0 | 300.0 |
coal | 3 | 300.000 | 0.0000 | 0.0 | 300.0 |
coal | 4 | 17.949 | 148.4480 | 189.2 | 489.2 |
coal | 5 | 166.397 | 0.0000 | 1022.7 | 1511.9 |
coal | 6 | 166.397 | -0.0000 | 0.0 | 1511.9 |
coal | 7 | 0.0 | |||
steel | 0 | 0.000 | 80.0000 | ||
steel | 1 | 135.342 | 12.2811 | 0.0 | 350.0 |
steel | 2 | 181.660 | 0.0000 | 0.0 | 350.0 |
steel | 3 | 193.090 | 0.0000 | 0.0 | 350.0 |
steel | 4 | 105.668 | 0.0000 | 0.0 | 350.0 |
steel | 5 | 105.668 | 0.0000 | 0.0 | 350.0 |
steel | 6 | 105.668 | -0.0000 | 0.0 | 350.0 |
steel | 7 | 0.0 | |||
transport | 0 | 0.000 | 100.0000 | ||
transport | 1 | 140.722 | 6.2408 | 0.0 | 280.0 |
transport | 2 | 200.580 | 0.0000 | 0.0 | 280.0 |
transport | 3 | 267.152 | 0.0000 | 0.0 | 280.0 |
transport | 4 | 92.308 | 0.0000 | 0.0 | 280.0 |
transport | 5 | 92.308 | 0.0000 | 0.0 | 280.0 |
transport | 6 | 92.308 | 0.0000 | 0.0 | 280.0 |
transport | 7 | 0.0 |
For Problem2, the right-hand side of each Continuity_con constraint changes to 0:
use problem Problem2; for {i in INDUSTRIES, year in YEARS} do; Continuity_con[i,year].lb = 0; Continuity_con[i,year].ub = 0; end; solve; print Production Stock ExtraCapacity ProductiveCapacity Manpower_con.body;
Figure 9.3 shows the output from the linear programming solver for Problem2.
Figure 9.3: Output from Linear Programming Solver for Problem2
Problem Summary | |
---|---|
Objective Sense | Maximization |
Objective Function | TotalProduction |
Objective Type | Linear |
Number of Variables | 63 |
Bounded Above | 0 |
Bounded Below | 51 |
Bounded Below and Above | 0 |
Free | 0 |
Fixed | 12 |
Number of Constraints | 42 |
Linear LE (<=) | 24 |
Linear EQ (=) | 18 |
Linear GE (>=) | 0 |
Linear Range | 0 |
Constraint Coefficients | 255 |
[1] | [2] | Production | Stock | ExtraCapacity | ProductiveCapacity |
---|---|---|---|---|---|
coal | 0 | 0.000 | 150.000 | ||
coal | 1 | 300.000 | 20.110 | 0.0000 | 300.00 |
coal | 2 | 315.323 | 131.554 | 15.3230 | 315.32 |
coal | 3 | 430.505 | 0.000 | 115.1817 | 430.50 |
coal | 4 | 430.505 | 0.000 | 0.0000 | 430.50 |
coal | 5 | 430.505 | 0.000 | 0.0000 | 430.50 |
coal | 6 | 166.397 | 324.108 | 0.0000 | 430.50 |
coal | 7 | 0.0000 | |||
steel | 0 | 0.000 | 80.000 | ||
steel | 1 | 86.730 | 11.532 | 0.0000 | 350.00 |
steel | 2 | 155.337 | 0.000 | 0.0000 | 350.00 |
steel | 3 | 182.867 | 0.000 | 0.0000 | 350.00 |
steel | 4 | 359.402 | 0.000 | 9.4023 | 359.40 |
steel | 5 | 359.402 | 176.535 | 0.0000 | 359.40 |
steel | 6 | 105.668 | 490.269 | 0.0000 | 359.40 |
steel | 7 | 0.0000 | |||
transport | 0 | 0.000 | 100.000 | ||
transport | 1 | 141.312 | 0.000 | 0.0000 | 280.00 |
transport | 2 | 198.388 | 0.000 | 0.0000 | 280.00 |
transport | 3 | 225.918 | 0.000 | 0.0000 | 280.00 |
transport | 4 | 519.383 | 0.000 | 239.3826 | 519.38 |
transport | 5 | 519.383 | 293.465 | 0.0000 | 519.38 |
transport | 6 | 92.308 | 750.540 | 0.0000 | 519.38 |
transport | 7 | 0.0000 |
For Problem3, the right-hand side of each Continuity_con[i,year] constraint changes back to demand[i]:
use problem Problem3; for {i in INDUSTRIES, year in YEARS} do; Continuity_con[i,year].lb = demand[i]; Continuity_con[i,year].ub = demand[i]; end; solve; print Production Stock ExtraCapacity ProductiveCapacity Manpower_con.body; quit;
Figure 9.4 shows the output from the linear programming solver for Problem3.
Figure 9.4: Output from Linear Programming Solver for Problem3
Problem Summary | |
---|---|
Objective Sense | Maximization |
Objective Function | TotalManpower |
Objective Type | Linear |
Number of Variables | 63 |
Bounded Above | 0 |
Bounded Below | 51 |
Bounded Below and Above | 0 |
Free | 0 |
Fixed | 12 |
Number of Constraints | 36 |
Linear LE (<=) | 18 |
Linear EQ (=) | 18 |
Linear GE (>=) | 0 |
Linear Range | 0 |
Constraint Coefficients | 219 |
[1] | [2] | Production | Stock | ExtraCapacity | ProductiveCapacity |
---|---|---|---|---|---|
coal | 0 | 0.00 | 150.0000 | ||
coal | 1 | 251.79 | 0.0000 | 0.0000 | 300.00 |
coal | 2 | 316.02 | 0.0000 | 16.0152 | 316.02 |
coal | 3 | 319.83 | 0.0000 | 3.8168 | 319.83 |
coal | 4 | 366.35 | 0.0000 | 46.5177 | 366.35 |
coal | 5 | 859.36 | 0.0000 | 493.0099 | 859.36 |
coal | 6 | 859.36 | 460.2080 | 0.0000 | 859.36 |
coal | 7 | 0.0000 | |||
steel | 0 | 0.00 | 80.0000 | ||
steel | 1 | 134.79 | 11.0280 | 0.0000 | 350.00 |
steel | 2 | 175.04 | 0.0000 | 0.0000 | 350.00 |
steel | 3 | 224.06 | 0.0000 | 0.0000 | 350.00 |
steel | 4 | 223.14 | 0.0000 | 0.0000 | 350.00 |
steel | 5 | 220.04 | 0.0000 | 0.0000 | 350.00 |
steel | 6 | 350.00 | 0.0000 | 0.0000 | 350.00 |
steel | 7 | 0.0000 | |||
transport | 0 | 0.00 | 100.0000 | ||
transport | 1 | 143.56 | 4.2472 | 0.0000 | 280.00 |
transport | 2 | 181.68 | 0.0000 | 0.0000 | 280.00 |
transport | 3 | 280.00 | 0.0000 | 0.0000 | 280.00 |
transport | 4 | 279.07 | 0.0000 | 0.0000 | 280.00 |
transport | 5 | 275.98 | 0.0000 | 0.0000 | 280.00 |
transport | 6 | 195.54 | 0.0000 | 0.0000 | 280.00 |
transport | 7 | 0.0000 |