如何在opl cplex中找到约束条件?

时间:2016-06-29 00:43:20

标签: cplex slack opl

我有一个MIP模型,我想知道哪些约束是活跃的。

谢谢

1 个答案:

答案 0 :(得分:0)

让我举个小例子:

dvar float+ Gas;
dvar float+ Chloride;


maximize
  40 * Gas + 50 * Chloride;
subject to {
 ctMaxTotal:     
Gas + Chloride <= 50;
  ctMaxTotal2:    
3 * Gas + 4 * Chloride <= 180;
  ctMaxChloride:  
Chloride <= 40;
}

float slackCtMaxTotal=slack(ctMaxTotal);
float slackCtMaxTotal2=slack(ctMaxTotal2);
float slackCtMaxChloride=slack(ctMaxChloride);

execute
{
writeln("slack1= ",slackCtMaxTotal);
writeln("slack2= ",slackCtMaxTotal2);
writeln("slack3= ",slackCtMaxChloride);
}