Topic
• 7 replies
• Latest Post - ‏2017-03-26T17:19:55Z by AlexFleischer
IdoR
1 Post

# Pinned topic Sensitivity analysis report

‏2013-07-31T00:14:38Z | analysis right-hand sensitivity side

Hi

I'm relatively new with OPL.

How can I see the allowable ranges for the right-hand side and for the coefficients of the objective function value after the problem is solved? these are usually called "maximum allowable increase" and "maximum allowable decrease". Is it possible to specify the constraints / coefficients of interest so not to try to display or print too much information?

The allowable ranges are not displayed by clicking over the constraint / variable name in the Problem browser. And couldn't find neither a specific command to display this information. The only commands I could find are: dual, slack, UB and LB for the constraints, and reducedCost for the variables.

Hernan

Updated on 2013-07-31T00:16:33Z at 2013-07-31T00:16:33Z by IdoR
• AlexFleischer
2825 Posts

#### Re: Sensitivity analysis report

‏2013-07-31T06:13:04Z

Hi,

let me give you an example:

dvar float+ Gas[1..1];
dvar float+ Chloride[1..1];

maximize
40 * Gas[1] + 50 * Chloride[1];
subject to {

ctMaxTotal:
Gas[1] + Chloride[1] <= 50;
ctMaxTotal2:
3 * Gas[1] + 4 * Chloride[1] <= 180;
ctMaxChloride:
Chloride[1] <= 40;
}

and then if you right click on Gas in the IDE you get sensitivity analysis.

If you need more than what is available thru scripting you may use an external java call.

Regards

• pieterce
9 Posts

#### Re: Sensitivity analysis report

‏2017-03-25T18:16:02Z

Hi,

let me give you an example:

dvar float+ Gas[1..1];
dvar float+ Chloride[1..1];

maximize
40 * Gas[1] + 50 * Chloride[1];
subject to {

ctMaxTotal:
Gas[1] + Chloride[1] <= 50;
ctMaxTotal2:
3 * Gas[1] + 4 * Chloride[1] <= 180;
ctMaxChloride:
Chloride[1] <= 40;
}

and then if you right click on Gas in the IDE you get sensitivity analysis.

If you need more than what is available thru scripting you may use an external java call.

Regards

Hi @AlexFleischer

I have developed my MIP and want to check the sensitivity. I read a lot on this forum about different ways of doing this but am a bit confused now what is the easiest way.

Shadow prices, reduced cost and sensitivity ranges should apparently be fairly easy to compute. However, I cannot make it work.

Also, how can I see which constraints are binding and which are not?

I am working in Cplex Version: 12.6.3.0.

Attached you find an example of my model.

#### Attachments

• AlexFleischer
2825 Posts

#### Re: Sensitivity analysis report

‏2017-03-26T07:32:34Z

Hi,

let me give you an example:

dvar float+ Gas[1..1];
dvar float+ Chloride[1..1];

maximize
40 * Gas[1] + 50 * Chloride[1];
subject to {

ctMaxTotal:
Gas[1] + Chloride[1] <= 50;
ctMaxTotal2:
3 * Gas[1] + 4 * Chloride[1] <= 180;
ctMaxChloride:
Chloride[1] <= 40;
}

and then if you right click on Gas in the IDE you get sensitivity analysis.

If you need more than what is available thru scripting you may use an external java call.

Regards

Hi,

to Know whether a constraint Is binding you Could use slack

regards

• pieterce
9 Posts

#### Re: Sensitivity analysis report

‏2017-03-26T11:56:41Z

Hi,

to Know whether a constraint Is binding you Could use slack

regards

Hi @AlexFleischer

Thanks for the quick reply! However, CPLEX returns an error message when I run the following​:

forall (t in T)

{
ct1: sum(k in 1..t) G[k] <= t * ravg + sqrt(t) * rstdev * Z_alpha_U;

}

execute
{
writeln( ct1.name," ",ct1.UB," ",ct1.LB," ",ct1.dual," ",ct1.slack);
}

For technical reasons, the lower and upper bound properties LB and UB are currently accessible only during postprocessing and flow control in constraints assigned in a `forall` declaration. The `undefined` value is returned instead.

How can I get the UB, LB, dual and slack for forall loops?

• AlexFleischer
2825 Posts

#### Re: Sensitivity analysis report

‏2017-03-26T15:46:35Z
• pieterce
• ‏2017-03-26T11:56:41Z

Hi @AlexFleischer

Thanks for the quick reply! However, CPLEX returns an error message when I run the following​:

forall (t in T)

{
ct1: sum(k in 1..t) G[k] <= t * ravg + sqrt(t) * rstdev * Z_alpha_U;

}

execute
{
writeln( ct1.name," ",ct1.UB," ",ct1.LB," ",ct1.dual," ",ct1.slack);
}

For technical reasons, the lower and upper bound properties LB and UB are currently accessible only during postprocessing and flow control in constraints assigned in a `forall` declaration. The `undefined` value is returned instead.

How can I get the UB, LB, dual and slack for forall loops?

Hi,

for each constraint you have a slack, a UB and son on so you d rather write

execute
{
for (var t in T) writeln( ct1[t].name," ",ct1[t].UB," ",ct1[t].LB," ",ct1[t].dual," ",ct1[t].slack);
}

regards

• pieterce
9 Posts

#### Re: Sensitivity analysis report

‏2017-03-26T16:39:56Z

Hi,

for each constraint you have a slack, a UB and son on so you d rather write

execute
{
for (var t in T) writeln( ct1[t].name," ",ct1[t].UB," ",ct1[t].LB," ",ct1[t].dual," ",ct1[t].slack);
}

regards

Thanks @AlexFleischer ​, it works! I am just wondering how to interpret the output for the following 4 constraints as it sometimes says undefined:

ct1[1] 21.71 -Infinity undefined 1.71

ct2[1] 0 -Infinity undefined 180
ct6[5][1] 480 -Infinity undefined 0

ct4[1][1] Infinity 77.4388 undefined -142.5612

Thanks a lot!!

• AlexFleischer
2825 Posts

#### Re: Sensitivity analysis report

‏2017-03-26T17:19:55Z
• pieterce
• ‏2017-03-26T16:39:56Z

Thanks @AlexFleischer ​, it works! I am just wondering how to interpret the output for the following 4 constraints as it sometimes says undefined:

ct1[1] 21.71 -Infinity undefined 1.71

ct2[1] 0 -Infinity undefined 180
ct6[5][1] 480 -Infinity undefined 0

ct4[1][1] Infinity 77.4388 undefined -142.5612

Thanks a lot!!

Hi,

this is quite normal since you ve got integer decision variables.

in order to get dual after relaxing the integrity constraints.

regards