使用GetConflict或
时,Cplex(12.6或12.8)未检测到不可行的变量范围我从http://www-01.ibm.com/support/docview.wss?uid=swg21429472
运行了代码IBM的示例采用了问题的所有原始约束,并将所有变量边界添加为附加约束。
我已经将此lp模型用于测试
Maximize
obj: x1 + 2 x2 + 3 x3
Subject To
c1: x2 + x3 <= 20
c2: x1 - 3 x2 + x3 <= 30
c3: x1<= 20
c4: x1>=40
Bounds
40 <= x1 <= 00
Generals
x1 x2 x3
End
注意:x1的边界是有意打破的。
使用这个经过编辑的lp文件,我希望CPLEX作为不可行集的成员返回打破界限。但事实并非如此。冲突集中仅排除了所有约束和界限
The IRange model including the variable bounds as constraints
The conflict refinement result: none of these constraints are in coflict (wrong!)
The cplex console output: correctly finds x1 is broken
如何解决此问题?我想在结果集中得到所有打破的约束。
答案 0 :(得分:0)
RefineConflict方法的文档说明:
要检查变量的边界是否引起冲突,请使用 ILOG.Concert.INumVarBound类的实例,以指定上面的 以及相关变量的下界。使用像这样的界限 您传递给fineConflict的参数之间的约束。
请牢记这一点,并以技术说明为起点,尝试改为使用以下代码块:
//add variable bounds to the constraints array
for(int c1=0;c1<lp.NumVars.Length;c1++)
{
if (lp.GetNumVar(c1).Type != NumVarType.Bool)
{
// Instead of the following:
// constraints[rng.Length + 2*numVarCounter] = cplex.AddLe(lp.GetNumVar(c1).LB, lp.GetNumVar(c1));
// constraints[rng.Length + 2 * numVarCounter].Name = lp.GetNumVar(c1).ToString() + "_LB";
// constraints[rng.Length + 2*numVarCounter + 1] = cplex.AddGe(lp.GetNumVar(c1).UB, lp.GetNumVar(c1));
// constraints[rng.Length + 2 * numVarCounter + 1].Name = lp.GetNumVar(c1).ToString() + "_UB";
// Use this:
constraints[rng.Length + 2 * numVarCounter] = cplex.Bound(lp.GetNumVar(c1), NumVarBoundType.Lower);
constraints[rng.Length + 2 * numVarCounter + 1] = cplex.Bound(lp.GetNumVar(c1), NumVarBoundType.Upper);
numVarCounter++;
}
}
有了这些更改,我得到以下输出:
Warning: Bound infeasibility column 'x1'.
Solution status = Infeasible
Model Infeasible, Calling CONFLICT REFINER
Number of SOSs=0
Conflict Refinement process finished: Printing Conflicts
Proved : IloRange c3 : -infinity <= (1*x1) <= 20
Proved : IloRange c4 : 40 <= (1*x1) <= infinity
Conflict Summary:
Constraint conflicts = 2
Variable Bound conflicts = 0
SOS conflicts = 0
Calling FEASOPT
Warning: Bound infeasibility column 'x1'.
FeasOpt failed- Could not repair infeasibilities