Hi,
I dont know why we use IMPVAR.
I have the following code
PROC OPTMODEL;
/* declare sets and parameters */
set RESOURCES = /labor metal wood/;
set PRODUCTS = /desks chairs bookcases bedframes/;
num selling_price {PRODUCTS} = [94 79 125 109];
num cost {RESOURCES} = [14 20 11];
num availability {RESOURCES} = [225 117 420];
num required {PRODUCTS, RESOURCES} =
[2 1 3
1 1 3
3 1 4
2 1 4];
/* declare variables */
var NumProd {PRODUCTS} >= 0;
impvar Revenue = sum {p in PRODUCTS}
selling_price[p] * NumProd[p];
impvar AmountUsed {r in RESOURCES} =
sum {p in PRODUCTS} NumProd[p] * required[p,r];
impvar TotalCost = sum {r in RESOURCES}
cost[r] * AmountUsed[r];
/* declare constraints */
con Usage {r in RESOURCES}:
AmountUsed[r] <= availability[r];
/* declare objective */
max NetProfit = Revenue - TotalCost;
/*print model formulation*/
expand;
/*solve the model*/
solve;
/*print parts of the model*/
print NumProd;
quit;
I have two question:
1-Please can someone tell me why are we using IMPVAR?
2- Can someone solve the above example using VAR only so that I can know the difference between VAR and IMPVAR.
thanks