Sensitivity Analysis

860 views
Skip to first unread message

Ratna S

unread,
Nov 27, 2017, 2:49:33 AM11/27/17
to AMPL Modeling Language
I am trying to do sensitivity analysis of the MILP attached. I followed the instructions in this video https://vimeo.com/140224142
Please tell me what I am doing wrong.

Here is what I am getting:

ampl: option presolve 0;
ampl: option cplex_options 'presolve 0 sensitivity';
ampl: model OperationalFL.run;

Presolve eliminates 0 constraints and 1188 variables.
Adjusted problem:
43181 variables:
1035 binary variables
345 integer variables
41801 linear variables
42499 constraints, all linear; 215976 nonzeros
6673 equality constraints
35826 inequality constraints
1 linear objective; 20890 nonzeros.

CPLEX 12.7.0.0: timing=1
timelimit=3600
mipdisplay=2
lpdisplay=1
mipgap=.005
MIP Presolve eliminated 38278 rows and 33329 columns.
MIP Presolve modified 595 coefficients.
Reduced MIP has 2501 rows, 8132 columns, and 28997 nonzeros.
Reduced MIP has 0 binaries, 134 generals, 0 SOSs, and 0 indicators.
Reduced MIP has 2501 rows, 8132 columns, and 28997 nonzeros.
Reduced MIP has 0 binaries, 134 generals, 0 SOSs, and 0 indicators.
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 4 threads.
Root relaxation solution time = 0.56 sec. (126.00 ticks)

        Nodes                                         Cuts/
   Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

*     0+    0                     -4.15099e+007  2.48426e+008           698.47%
      0     0  -487793.3881    59 -4.15099e+007  -487793.3881     4780   98.82%
*     0+    0                      -519950.7937  -487793.3881             6.18%
      0     0  -489716.5666    54  -519950.7937     Cuts: 126     4880    5.81%
      0     0  -489905.9992    52  -519950.7937      Cuts: 43     4913    5.78%
*     0+    0                      -493154.7878  -489905.9992             0.66%
      0     0  -489907.5943    52  -493154.7878    MIRcuts: 2     4919    0.66%
      0     0  -489907.6812    52  -493154.7878    MIRcuts: 6     4921    0.66%
      0     2  -489907.6812    52  -493154.7878  -490254.5734     4921    0.59%
Elapsed time = 3.61 sec. (976.04 ticks, tree = 0.01 MB)
    176   146  -491973.8983    28  -493154.7878  -490254.5734     7525    0.59%
    340   254  -491884.1090    27  -493154.7878  -490254.5734    10120    0.59%
    400   275  -491407.8291    34  -493154.7878  -490254.5734    10326    0.59%
    576   427  -490815.6776    38  -493154.7878  -490254.5734    13152    0.59%
    907   696  -490650.3744    39  -493154.7878  -490254.5734    17314    0.59%
   1280   945  -490534.4355    46  -493154.7878  -490254.5734    21705    0.59%
   1317  1115  -490422.1013    48  -493154.7878  -490425.0380    28740    0.55%
   1337  1125  -491979.6159    33  -493154.7878  -490427.3616    29103    0.55%
   1356    51  -490829.5329    41  -493154.7878  -490427.3616    29364    0.55%

Mixed integer rounding cuts applied:  44
Lift and project cuts applied:  59
Gomory fractional cuts applied:  9

Root node processing (before b&c):
  Real time             =    3.61 sec. (974.32 ticks)
Parallel b&c, 4 threads:
  Real time             =    8.31 sec. (4756.69 ticks)
  Sync time (average)   =    0.51 sec.
  Wait time (average)   =    0.01 sec.
                          ------------
Total (root+branch&cut) =   11.92 sec. (5731.00 ticks)

Times (seconds):
Input =  0.15625
Solve =  41.3125
Output = 0
CPLEX 12.7.0.0: optimal integer solution within mipgap or absmipgap; objective -493154.7878
30380 MIP simplex iterations
1397 branch-and-bound nodes
absmipgap = 2464.36, relmipgap = 0.00499714
No basis.

[....]

Presolve eliminates 0 constraints and 1200 variables.
Adjusted problem:
43181 variables:
1035 binary variables
345 integer variables
41801 linear variables
42499 constraints, all linear; 215976 nonzeros
6673 equality constraints
35826 inequality constraints
1 linear objective; 20890 nonzeros.

[....]

ampl: display _varname, _var, _var.rc, _var.current, _var.up, _var.down;

Bad suffix .current for _var
context:  display _varname, _var, _var.rc,  >>> _var.current, <<<  _var.up, _var.down;
Possible suffix values for _var.suffix:
astatus   defeqn   derstage   dual
init      init0    int        lb
lb0       lb1      lb2        lrc
lslack    no       rc         relax
slack     sno      sstatus    stage
status    ub       ub0        ub1
ub2       urc      uslack     val

Bad suffix .up for _var
context:  display _varname, _var, _var.rc, _var.current,  >>> _var.up, <<<  _var.down;
Possible suffix values for _var.suffix:
astatus   defeqn   derstage   dual
init      init0    int        lb
lb0       lb1      lb2        lrc
lslack    no       rc         relax
slack     sno      sstatus    stage
status    ub       ub0        ub1
ub2       urc      uslack     val

Bad suffix .down for _var
context:  display _varname, _var, _var.rc, _var.current, _var.up,  >>> _var.down; <<< 
Possible suffix values for _var.suffix:
astatus   defeqn   derstage   dual
init      init0    int        lb
lb0       lb1      lb2        lrc
lslack    no       rc         relax
slack     sno      sstatus    stage
status    ub       ub0        ub1
ub2       urc      uslack     val
ampl: display _conname, _con.body, _con.slack, _con.dual, _con.current, _con.up, _con.down;

Bad suffix .current for _con
context:  display _conname, _con.body, _con.slack, _con.dual,  >>> _con.current, <<<  _con.up, _con.down;
Possible suffix values for _con.suffix:
astatus   body      defvar   derstage
dinit     dinit0    dual     lb
lbs       lbs1      lbs2     ldual
lslack    no        relax    slack
sno       sstatus   stage    status
ub        ubs       ubs1     ubs2
udual     uslack 

Bad suffix .up for _con
context:  display _conname, _con.body, _con.slack, _con.dual, _con.current,  >>> _con.up, <<<  _con.down;
Possible suffix values for _con.suffix:
astatus   body      defvar   derstage
dinit     dinit0    dual     lb
lbs       lbs1      lbs2     ldual
lslack    no        relax    slack
sno       sstatus   stage    status
ub        ubs       ubs1     ubs2
udual     uslack 

Bad suffix .down for _con
context:  display _conname, _con.body, _con.slack, _con.dual, _con.current, _con.up,  >>> _con.down; <<< 
Possible suffix values for _con.suffix:
astatus   body      defvar   derstage
dinit     dinit0    dual     lb
lbs       lbs1      lbs2     ldual
lslack    no        relax    slack
sno       sstatus   stage    status
ub        ubs       ubs1     ubs2
udual     uslack 


 
OperationalFL.run
OperfinFL.mod
Tomatopostday.xls
test.dsn

Robert Fourer

unread,
Nov 28, 2017, 10:40:01 PM11/28/17
to am...@googlegroups.com
Add 'mipbasis 1' to your cplex_options string. (For the current version of CPLEX this is the default, but earlier versions defaulted to 'mipbasis 0'.)

Be aware however that you will only get a sensitivity analysis of the linear program that results after all of the binary & integer variables have been fixed at their optimal values. If you want to know how a change to some objective coefficient or right-hand side constant affects the solution to the overall mixed-integer problem, you will need to make the change yourself and then re-solve.

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of Ratna S
Sent: Monday, November 27, 2017 1:50 AM
To: AMPL Modeling Language
Subject: [AMPL 15222] Sensitivity Analysis

I am trying to do sensitivity analysis of the MILP attached. I followed the instructions in this video https://vimeo.com/140224142
Please tell me what I am doing wrong.

Here is what I am getting:

ampl: option presolve 0;
ampl: option cplex_options 'presolve 0 sensitivity';
ampl: model OperationalFL.run;

.......

ampl: display _varname, _var, _var.rc, _var.current, _var.up, _var.down;

Bad suffix .current for _var
...


Ratna S

unread,
Nov 29, 2017, 11:25:37 AM11/29/17
to AMPL Modeling Language
I was getting this error

Bad suffix .current for _var
context:  display _varname, _var, _var.rc,  >>> _var.current, <<<  _var.up, _var.down;
Possible suffix values for _var.suffix:
astatus   defeqn   derstage   dual
init      init0    int        lb
lb0       lb1      lb2        lrc
lslack    no       rc         relax
slack     sno      sstatus    stage
status    ub       ub0        ub1
ub2       urc      uslack     val

So I changed it to the following and it works:

display _varname, _var, _var.rc, _var.val, _var.ub, _var.lb;

Does .current and .val give the same attribute?

what is the equivalent suffix for constraint?

because I am getting this error for constraint


Bad suffix .val for _con
context:  display _conname, _con.body, _con.slack, _con.dual,  >>> _con.val, <<<  _con.ub, _con.lb;
Possible suffix values for _con.suffix:
astatus   body      defvar   derstage
dinit     dinit0    dual     lb
lbs       lbs1      lbs2     ldual
lslack    no        relax    slack
sno       sstatus   stage    status
ub        ubs       ubs1     ubs2
udual     uslack 

Robert Fourer

unread,
Nov 30, 2017, 12:15:51 PM11/30/17
to am...@googlegroups.com
.current, .up, and .down are sensitivity analysis values returned by CPLEX: for variables, .current is the value of the variable's coefficient in the objective function, .up is the largest value that the coefficient can take before the current basis becomes suboptimal, and .down is the smallest value that the coefficient can take before the current basis becomes suboptimal. If you do not see these in the list of "Possible suffix values for var.suffix" in the error message, then CPLEX has not run the sensitivity analysis. You will need to include 'sensitivity' in the cplex_options string to get a sensitivity analysis, and for MIPs you may need to also include 'mipbasis=1' (depending on your CPLEX version).

.val, .ub, and .lb are not related to the sensitivity analysis: .val is the value of the variable, .ub is its upper bound in the problem, and .ub is its lower bound in the problem. _var alone is equivalent to _var.val, and also _con alone is equivalent to _con.dual. You cannot determine any sensitivity ranges from these suffixes.

Ratna S

unread,
Dec 1, 2017, 4:12:32 PM12/1/17
to AMPL Modeling Language
Does this change in the string need to be made in my .run file?

This is what I have in my .run file:

# Options Selected for CPLEX Solver #
option solver cplexamp;

option cplex_options 'timing=1 timelimit=3600 mipdisplay=2 lpdisplay=1 mipgap=.005 sensitivity';

solve;

And I am getting the errorr:

Bad suffix .current for _con
context:  display _conname, _con.body, _con.slack, _con.dual,  >>> _con.current, <<<  _con.up, _con.down;
Possible suffix values for _con.suffix:
astatus   body      defvar   derstage
dinit     dinit0    dual     lb
lbs       lbs1      lbs2     ldual
lslack    no        relax    slack
sno       sstatus   stage    status
ub        ubs       ubs1     ubs2
udual     uslack 

So it is still not running sensitivity analysis even though I put 'sensitivity' in the string???

Robert Fourer

unread,
Dec 3, 2017, 12:59:44 PM12/3/17
to am...@googlegroups.com
Yes, you should include mipbasis=1 in your "option cplex_options ..." statement in your .run file.
Reply all
Reply to author
Forward
0 new messages