无法在 CPLEX 和 MATLAB 上为二次规划找到相同的解决方案

Unable to find the same solution on CPLEX and MATLAB for a quadratic program

我正在尝试使用 MATLAB(使用 quadprog 函数)和 CPLEX 解决以下二次问题。问题是 MATLAB 和 CPLEX 提供了可行的解决方案,但两种解决方案都不匹配。事实上,CPLEX 声称获得的解决方案是最优的,而使用 MATLAB 获得的解决方案在 objective.

方面更好
Minimize obj= 0.5*(1100*x^2 + 509*y^2 + 33*z^2 + 1060*x*y + 252*y*z + 260*z*x)- 60*x- 36*y - 11*z

Subject to:
-x-y+z <= 10
-x+y-z <= 10
-x+y+z <= 10
x-y-z <= 10
x-y+z <= 10
x+y-z <= 10
x+y+z <= 10
-x-y-z <= 10
x,y and z are real numbers.

In matlab, I got: obj=-3, x=0.0436, y=-0.2670, z=1.1830
In CPLEX, I got: obj=-2.07, x=0.028, y=0.000, z=0.222

我不明白为什么。

我尝试用 MATLAB 和 CPLEX 解决问题,但解决方案不匹配。

您试过哪个 cplex 版本?

我写了

dvar float x;
dvar float y;
dvar float z;

minimize 0.5*(1100*x^2 + 509*y^2 + 33*z^2 + 1060*x*y + 252*y*z + 260*z*x)- 60*x- 36*y - 11*z;

subject to
{
-x-y+z <= 10;
-x+y-z <= 10;
-x+y+z <= 10;
x-y-z <= 10;
x-y+z <= 10;
x+y-z <= 10;
x+y+z <= 10;
-x-y-z <= 10;
}

在 OPL CPLEX 中并得到 obj -3

x = 0.043662;
y = -0.26761;
z = 1.1831;

和 docplex python 我也得到相同的结果

from docplex.mp.model import Model

mdl = Model(name='quad')

x=mdl.continuous_var(name='x',lb=-10,ub=10)
y=mdl.continuous_var(name='y',lb=-10,ub=10)
z=mdl.continuous_var(name='z',lb=-10,ub=10)



mdl.minimize(0.5*(1100*x*x + 509*y*y + 33*z*z + 1060*x*y + 252*y*z + 260*z*x)- 60*x- 36*y - 11*z)


mdl.add(-x-y+z <= 10)
mdl.add(-x+y-z <= 10)
mdl.add(-x+y+z <= 10)
mdl.add(x-y-z <= 10)
mdl.add(x-y+z <= 10)
mdl.add(x+y-z <= 10)
mdl.add(x+y+z <= 10)
mdl.add(-x-y-z <= 10)

mdl.solve(log_output=True,)

decisionVars=[x,y,z]
for v in decisionVars:
    print(v.name," = ",v.solution_value)

print(mdl.objective_value)