This is more of a show and tell rather than a question.
For those that are using the SAS University Edition that don't have access to PROC OPTMODEL, I created an example of how to solve for an Optimal Mix of products that a company would need to sell.
In this example we have demand for 1,200 barrels of crude oil, but we can supply only 1,000. How much of each type of fuel should I produce given the different demand for the given types of fuels.
PROC IML;
names={'87' '89' '91' '93' 'Diesel'};
names2={'Supply' '87' '89' '91' '93' 'Diesel'};
/*number of variables */
n=ncol(A);
/*Maximize, Print Solver Info*/
cntl = {-1,1};
/* Objective Function - Pofit Values of each segments for one oil plant*/
obj = {70 50 30 80 100}; /*Profit = 87[70][X1] + 89[50][X1] + 91[30][X1] + 93[80][X1] + Diesel[100][X1]*/
/* coefficients of the constraint equation*/
A = {
1 1 1 1 1 /*Turn on ALL the segments to later constrain Total Supply*/
,1 0 0 0 0 /*Turn on 87 to later constrain 87 Demand*/
,0 1 0 0 0 /*Turn on 89 to later constrain 89 Demand*/
,0 0 1 0 0 /*Turn on 91 to later constrain 91 Demand*/
,0 0 0 1 0 /*Turn on 93 to later constrain 93 Demand*/
,0 0 0 0 1 /*Turn on Diesel to later constrain Diesel Demand*/
};
/*Constraint Values*/
con = {
1000 /*Total Supply*/
,100 /*87 Demand*/
,200 /*89 Demand*/
,600 /*91 Demand*/
,200 /*93 Demand*/
,100 /*Diesel Demand*/
};
/*Constraint Operators: 'L' for <=, 'G' for >=, 'E' for =*/
ops = {
'L' /*87[1] + 89[1] + 91[1] + 93 [1] + Diesel[1] <= 1000*/
,'L' /*87[1] + 89[0] + 91[0] + 93 [0] + Diesel[0] <= 100*/
,'L' /*87[0] + 89[1] + 91[0] + 93 [0] + Diesel[0] <= 200*/
,'L' /*87[0] + 89[0] + 91[1] + 93 [0] + Diesel[0] <= 600*/
,'L' /*87[0] + 89[0] + 91[0] + 93 [1] + Diesel[0] <= 200*/
,'L' /*87[0] + 89[0] + 91[0] + 93 [0] + Diesel[1] <= 100*/
};
call lpsolve(rc, value, x, dual, redcost,obj, A, con, cntl, ops);
/*Print Solver Information to Results, can do an ODS option to print to a dataset*/
lhs = A*x;
Constraints = con || lhs ;
print Constraints[r=names2
c={"Demand" "Optimal"}
L= "Optimal Mix"];
print obj[L={"Profit Per Segment"} c=names];
print value[L='Maximum Profit'];
QUIT;
The output shows that since 91 octane is the least profitable, it displaced 200 to make sure that demand is met for the other fuel types.
Note: I do not work for the oil industry or did any research on the topic, so please forgive any misleading assumptions on how an oil company makes decision of production of different fuels.
... View more