Hi,
I am trying to perform sensitivity analysis on a model that I have built for my OR class and I cannot get it to give me the upper and lower ranges. My questions are:
1. Do I need to have a .dat file for the sensitivity analysis to work properly?
2. What am I doing wrong? Everything I am reading online tells me I am using the .up, .current, and .down correct?
AMPL keeps telling me:
Bad suffix .up for worth
context:
display >>> x3.up, <<<
x3.current, x3.down;
Possible suffix values for worth.suffix:
astatus exitcode
message no
relax result
sense sno
sstatus stage
val
param investment = 20000;
param extcows = 30;
param exthens = 2000;
param cowsvalue = 35000;
param hensvalue = 5000;
param cowsdeprc = 0.1;
param hensdeprc = 0.25;
param totalwinterspringhours = 4000;
param totalsummerfallhours = 4500;
param totalland = 640;
var x1 >= 0 integer; #new cows
var x2 >= 0 integer; #new hens
var x3 >= 0; #soy
var x4 >= 0; #corn
var x5 >= 0; #wheat
maximize worth: 1350*extcows + 5.25*exthens + 1350*x1 + 5.25*x2 +
70*x3 + 60*(x4-extcows-x1) + 40*(x5-.05*(x2+exthens)) +
(investment- 1500*x1 - 3*x2)+
.9*(cowsvalue +1500*x1)+
.75*(hensvalue + 3*x2)+
(totalwinterspringhours - (x5*.6 + x3 + 0.9*x4 + 60*extcows + 60*x1 + 0.3*exthens + 0.3*x2))*5+
(totalsummerfallhours - (1.4*x3 + 1.2*x4 + 0.7*x5 + 60*extcows + 60*x1 + 0.3*exthens + 0.3*x2))*5.5
-40000;
subject to
winterspringhoursconst: x5*.6 + x3 + 0.9*x4 + 60*extcows + 60*x1 + 0.3*exthens + 0.3*x2 <= totalwinterspringhours;
summerfallhoursconst: 1.4*x3 + 1.2*x4 + 0.7*x5 + 60*extcows + 60*x1 + 0.3*exthens + 0.3*x2 <= totalsummerfallhours;
maxcowconst: extcows + x1 <= 42;
maxhensconst: exthens + x2 <= 5000;
maxacresconst: 2*extcows + 2*x1 + x3 + x4 + x5 <= 640;
investmentfundconst: 1500*x1 + 3*x2 <= 20000;
mincorncost: x4 - x1 >= extcows;
minwheatconst: x5 - .05*x2 >= .05*exthens;
Here is my .run file:
# Reset command clears all the previous models, so that there are no conflicts
reset;
# Load model onto the environment. Use relative path of the files (e.g. folder where the files is)
model c:/Users/amplide.mswin32/myModels/Farm_Case_Study.mod;
# Solver Options
option solver cplex;
option cplex_options 'sensitivity';
option presolve 0;
# Solver the problem
solve;
# Objective function value
printf("************************************************************\n");
printf("Optimal objective function value: ");
display worth;
# Display primal solution
printf("Primal solution: ");
display x1, x2, x3, x4, x5, x1.rc, x2.rc, x3.rc, x4.rc, x5.rc;
# Display dual solution
printf("------------------------------------------------------------\n");
printf("Sensativity Analysis");
printf("Change to objective function coefficient: \n");
display x3.up, x3.current, x3.down;
#display x4.up, x4.current, x4.down;
#display x5.up, x5.current, x5.down;
printf("------------------------------------------------------------\n");
printf("Change to right-hand side: \n");
#display winterspringhoursconst.lbs,winterspringhoursconst.ubs ;
#display summerfallhoursconst.up, summerfallhoursconst.current, summerfallhoursconst.down;
#display maxcowconst.up, maxcowconst.current, maxcowconst.down;
#display maxhensconst.up, maxhensconst.current, maxhensconst.down;
#display maxacresconst.up, maxacresconst.current, maxacresconst.down;
#display investmentfundconst.up, investmentfundconst.current, investmentfundconst.down;
#display mincorncost.up, mincorncost.current, mincorncost.down;
#display minwheatconst.up, minwheatconst.current, minwheatconst.down;
printf("************************************************************\n");
Thank you for any advice you can provide!
Regards,
Mike