我对 CPLEX 很陌生,我正在编写一个非常简单的模型,CPLEX 不想满足它。我知道我的模型是“冗长的”,因为我有简单地等于其他变量的变量,但这是我迈向更复杂模型的第一步,所以我想要这种方式。我不明白为什么这会让 CPLEX 感到不安。
我的模型是:
Minimize
obj: v1
Subject To
l1: i_AB1 + i_AC1 - i_AB2 - i_AC3 = 1
l2: - i_AB1 + I_BB = 0
l3: I_CA + I_CC = 0
e5: i_AB2 + i_BD2 - I_BB = 0
e8: - i_AC1 - I_CA = 0
e9: i_AC3 + i_CD3 - I_CC = 0
\Indicator constraints
\For each connection XY
c1: bAB = 1-> i_AB1 - 1 v1 = 0
c2: bAB = 1-> i_AB2 - 1 v2 = 0
c5: bAC = 1-> i_AC1 - 1 v1 = 0
c6: bAC = 1-> i_AC3 - 1 v3 = 0
c9: bBD = 1-> i_BD2 - 1 v2 = 0
c13: bCD = 1-> i_CD3 - 1 v3 = 0
c15: bAB = 1
c16: bAC = 1
c17: bBD = 1
c18: bCD = 1
Bounds
0 <= v1 <= 1000
-1000 <= v2 <= 1000
-1000 <= v3 <= 1000
General
Binaries
bAB bAC bBD bCD
End
这显然没有解决方案(它有,或者至少这是我的意图,但 CPLEX 说不!)。
但是然后我将方程代e8
入l3
并得到我想要的解决方案!这是代码:
Minimize
obj: v1
Subject To
\budget:
l1: i_AB1 + i_AC1 - i_AB2 - i_AC3 = 1
l2: - i_AB1 + I_BB = 0
l3: - i_AC1 + I_CC = 0
e5: i_AB2 + i_BD2 - I_BB = 0
\Row C
\e8: - i_AC1 - I_CA = 0
e9: i_AC3 + i_CD3 - I_CC = 0
\Indicator constraints
\For each connection XY
c1: bAB = 1-> i_AB1 - 1 v1 = 0
c2: bAB = 1-> i_AB2 - 1 v2 = 0
c5: bAC = 1-> i_AC1 - 1 v1 = 0
c6: bAC = 1-> i_AC3 - 1 v3 = 0
c9: bBD = 1-> i_BD2 - 1 v2 = 0
c13: bCD = 1-> i_CD3 - 1 v3 = 0
c15: bAB = 1
c16: bAC = 1
c17: bBD = 1
c18: bCD = 1
Bounds
0 <= v1 <= 1000
-1000 <= v2 <= 1000
-1000 <= v3 <= 1000
General
Binaries
bAB bAC bBD bCD
End
在我看来,两者都是完全相同的模型。我做错了什么,以至于第一个模型没有解决方案,即使它看起来等同于第二个有解决方案的模型?
顺便说一句,解决方案是:
Populate: phase I
Tried aggregator 2 times.
MIP Presolve eliminated 4 rows and 4 columns.
Aggregator did 11 substitutions.
All rows and columns eliminated.
Presolve time = 0.00 sec.
Populate: phase II
Solution status: 129.
Objective value of the incumbent: 1
Incumbent: Column v1: Value = 1
Incumbent: Column i_AB1: Value = 1
Incumbent: Column i_AC1: Value = 1
Incumbent: Column i_AB2: Value = 0.5
Incumbent: Column i_AC3: Value = 0.5
Incumbent: Column I_BB: Value = 1
Incumbent: Column I_CC: Value = 1
Incumbent: Column i_BD2: Value = 0.5
Incumbent: Column i_CD3: Value = 0.5
Incumbent: Column bAB: Value = 1
Incumbent: Column v2: Value = 0.5
Incumbent: Column bAC: Value = 1
Incumbent: Column v3: Value = 0.5
Incumbent: Column bBD: Value = 1
Incumbent: Column bCD: Value = 1
The solution pool contains 1 solutions.
0 solutions were removed due to the solution pool relative gap parameter.
In total, 1 solutions were generated.
The average objective value of the solutions is 1.
Solution Objective Number of variables
value that differ compared to
the incumbent
p1 1 0 / 15
问题本身甚至不是 MIP(因为我在这个初始版本中修复了我的布尔值,但它将是一个正确的 MIP)。这会改变什么吗?我真的不明白问题是什么。
谢谢