Hello,
I'm trying to solve an elasticity problem in which I'm maximizing revenue such as the example presented here:
http://support.sas.com/documentation/cdl/en/ormpex/66104/HTML/default/viewer.htm#ormpex_ex21_sect009...
However, I'm trying to add a constraint so that the price of product A has to be the same price as the price in product B in the output. Which you'll see my attempt in the rack_rate_con constraint on the code.
Here is my current SAS Code:
/*Previous Prievious Price and Demand Data*/
data product_data;
input product $ prev_demand prev_price;
datalines;
Land 60 120
Trans 30 120
;
run;
/*Elasticity Data*/
data elasticity_data;
input i $ j $ elasticity;
datalines;
Land Land -0.85
Trans Trans -0.27
;
run;
proc optmodel;
/* set <str> RAWS;*/
/* num supply {RAWS};*/
/* read data raw_material_data into RAWS=[raw] supply;*/
set <str> PRODUCTS;
num prev_demand {PRODUCTS};
num prev_price {PRODUCTS};
/* num percent {PRODUCTS, RAWS};*/
read data product_data into PRODUCTS=[product] prev_demand prev_price;
num elasticity {PRODUCTS, PRODUCTS} init 0;
read data elasticity_data into [i j] elasticity;
var Price {PRODUCTS} >= 0;
var Demand {PRODUCTS} >= 0;
max TotalRevenue
= sum {product in PRODUCTS} Price[product] * Demand[product];
con Demand_con {i in PRODUCTS}:
(Demand[i] - prev_demand[i]) / prev_demand[i]
= sum {j in PRODUCTS} elasticity[i,j] * (Price[j] - prev_price[j]) /
prev_price[j];
con Price_index_con:
sum {product in PRODUCTS} prev_demand[product] * Price[product]
<= sum {product in PRODUCTS} prev_demand[product] * prev_price[product];
/* Attempting to add constraint to make sure the price of the two recommendations is the same*/
con rack_rate_con {i in PRODUCTS}:
sum {PRODUCTS} Price[i]
= sum {j in PRODUCTS} Price[j];
solve with NLP / algorithm=activeset MULTISTART SEED=7888422;
print Price Demand TotalRevenue;
print Price_index_con.dual;
print rack_rate_con.dual;
run;
I do not error out, but it's not suggesting any changes. However, If I add the FEASTOL=2 option, it starts suggesting rates that are close enough to each other, but the calculated demand is way off when enabling this option.
If I remove the rack_rate_con constraint altogether, the calculated demand looks reasonable.
Any help is appreciated.