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:
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 10.1 shows the output from the linear programming solver for the static model.
Figure 10.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 |
Performance Information | |
---|---|
Execution Mode | Single-Machine |
Number of Threads | 1 |
Solution Summary | |
---|---|
Solver | LP |
Algorithm | Dual Simplex |
Objective Function | Zero |
Solution Status | Optimal |
Objective Value | 0 |
Primal Infeasibility | 2.131628E-14 |
Dual Infeasibility | 0 |
Bound Infeasibility | 0 |
Iterations | 0 |
Presolve Time | 0.00 |
Solution Time | 0.00 |
[1] | StaticProduction |
---|---|
coal | 166.397 |
steel | 105.668 |
transport | 92.308 |
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 focus to the desired problem:
use problem Problem1; solve; print Production Stock ExtraCapacity ProductiveCapacity Manpower_con.body;
Figure 10.2 shows the output from the linear programming solver for Problem1.
Figure 10.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 |
Performance Information | |
---|---|
Execution Mode | Single-Machine |
Number of Threads | 1 |
Solution Summary | |
---|---|
Solver | LP |
Algorithm | Dual Simplex |
Objective Function | TotalProductiveCapacity |
Solution Status | Optimal |
Objective Value | 2141.8751967 |
Primal Infeasibility | 5.684342E-14 |
Dual Infeasibility | 0 |
Bound Infeasibility | 7.105427E-15 |
Iterations | 47 |
Presolve Time | 0.00 |
Solution Time | 0.00 |
[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 |
[1] | Manpower_con.BODY |
---|---|
1 | 224.99 |
2 | 270.66 |
3 | 367.04 |
4 | 470.00 |
5 | 150.00 |
6 | 150.00 |
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 10.3 shows the output from the linear programming solver for Problem2.
Figure 10.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 |
Performance Information | |
---|---|
Execution Mode | Single-Machine |
Number of Threads | 1 |
Solution Summary | |
---|---|
Solver | LP |
Algorithm | Dual Simplex |
Objective Function | TotalProduction |
Solution Status | Optimal |
Objective Value | 2618.5791147 |
Primal Infeasibility | 1.136868E-13 |
Dual Infeasibility | 3.32308E-17 |
Bound Infeasibility | 1.884826E-13 |
Iterations | 43 |
Presolve Time | 0.02 |
Solution Time | 0.02 |
[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 |
[1] | Manpower_con.BODY |
---|---|
1 | 240.41 |
2 | 321.55 |
3 | 384.17 |
4 | 470.00 |
5 | 470.00 |
6 | 150.00 |
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 10.4 shows the output from the linear programming solver for Problem3.
Figure 10.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 |
Performance Information | |
---|---|
Execution Mode | Single-Machine |
Number of Threads | 1 |
Solution Summary | |
---|---|
Solver | LP |
Algorithm | Dual Simplex |
Objective Function | TotalManpower |
Solution Status | Optimal |
Objective Value | 2450.0266228 |
Primal Infeasibility | 3.979039E-13 |
Dual Infeasibility | 0 |
Bound Infeasibility | 0 |
Iterations | 53 |
Presolve Time | 0.00 |
Solution Time | 0.00 |
[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 |
[1] | Manpower_con.BODY |
---|---|
1 | 226.63 |
2 | 279.98 |
3 | 333.73 |
4 | 539.77 |
5 | 636.82 |
6 | 659.72 |