简体   繁体   English

我想在cplex中找到约束的对偶

[英]I want to find the dual of a constraint in cplex

what is the way to find the dual for a constraint which is given below: 查找约束的对偶的方法是什么,如下所示:

    forall(t in tree, p in Pattern, m in Machine) Constraint1:
    TreeCutTime[t]>=BatchCutTime[p][m] - 1000(1- 
    p.BatchSetup[t]*BatchSelected[p][m])

where, 
Range of t = 1..10
Range of m = 1..2
Pattern = <1 [1 0 0 0 0 0 0 0 0 0], 5,5> and so on
BatchSelected= [1 0 0 0 0 0 0 0 0 0] and so on.

let me give you a small example out of the volsay example that is in the OPL directory. 让我从OPL目录中的volsay示例中给您一个小示例。

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;
}

execute
{
writeln(ctMaxTotal.dual);
writeln(ctMaxTotal2.dual);
writeln(ctMaxChloride.dual);

}

which gives 这使

// solution (optimal) with objective 2300
10
10
0

with 3D you only need to index: 使用3D,您只需索引:

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

dvar float obj;
maximize
 obj; 
subject to {
ctObj:obj==sum(i,j,k in 1..2 )(40 * Gas[i,j,k])  + sum(i,j,k in 1..2 ) (50 * Chloride[i,j,k]);

  forall(i,j,k in 1..2) ctMaxTotal:     
    Gas[i,j,k] + Chloride[i,j,k] <= 50;
  forall(i,j,k in 1..2 )ctMaxTotal2:    
    3 * Gas[i,j,k] + 4 * Chloride[i,j,k] <= 180;
  forall(i,j,k in 1..2 ) ctMaxChloride:  
    Chloride[i,j,k] <= 40;
}

execute
{
writeln("Chloride=",Chloride);
writeln("Gas=",Gas);
writeln("dual=",ctMaxTotal[1][2][1].dual);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM