我正在使用 CPLEX API 在 MATLAB 上运行 CPLEX(版本 125)。我正在尝试解决一个约束二次规划问题,但我遇到了一个根本不可行的问题。特别是,该问题的 MATLAB 代码是:
[ystar, Jstar, flag, output]= ...
cplexqp(H, f, F, phi, G, gamma, ymin, ymax);
这对应于问题:
ystar = argmin_y y'*H*y + f'*y
subject to:
ymin <= y <= ymax
G * y = gamma
F * y <= phi
但是,ystar
返回的解决方案cplexqcp
是这样的:
max(F*ystar-phi) = 5.1854e-05
我想减少这种不可行的差距。我试图改变最初的可行性界限,但似乎没有任何效果:
ops=cplexoptimset('cplex');
ops.feasopt.tolerance=1e-7;
如何配置求解器以平衡不可行性?求解器提供以下诊断消息:
Number of nonzeros in lower triangle of Q = 2622
Using Approximate Minimum Degree ordering
Summary statistics for factor of Q:
Rows in Factor = 4248
Integer space required = 4362
Total non-zeros in factor = 27048
Total FP ops to factor = 334848
Tried aggregator 1 time.
QP Presolve eliminated 1128 rows and 114 columns.
Aggregator did 80 substitutions.
Reduced QP has 7984 rows, 8302 columns, and 129418 nonzeros.
Reduced QP objective Q matrix has 4134 nonzeros.
Parallel mode: using up to 8 threads for barrier.
Number of nonzeros in lower triangle of A*A' = 433356
Using Approximate Minimum Degree ordering
Summary statistics for Cholesky factor:
Threads = 8
Rows in Factor = 7984
Integer space required = 32473
Total non-zeros in factor = 556316
Total FP ops to factor = 62101602
Itn Primal Obj Dual Obj Prim Inf Upper Inf Dual Inf
0 1.6154270e+04 -1.8807064e+06 1.92e+06 2.77e+05 5.03e+06
1 1.7649880e+06 -4.6190853e+06 5.23e+05 7.57e+04 1.37e+06
2 1.8883665e+06 -4.8518299e+06 1.30e+05 1.89e+04 3.42e+05
3 8.3385088e+05 -2.9607988e+06 2.05e+04 2.97e+03 5.39e+04
... (some lines are omitted for brevity)
31 9.9411620e+01 9.9411598e+01 1.10e-08 9.27e-10 4.32e-08
32 9.9411615e+01 9.9411611e+01 1.37e-08 1.47e-10 6.85e-09
33 9.9411614e+01 9.9411614e+01 2.19e-08 6.10e-12 2.51e-08
Barrier time = 1.91 sec. (361.06 ticks)
Total time on 8 threads = 1.91 sec. (361.06 ticks)
因此,该解决方案的原始不可行性似乎是2.19e-08
;但是,似乎该解决方案并不那么可行。
更新:我将等式和不等式约束标准化如下:
F = F ./ kron( ones(1,size(F,2)), abs(phi) );
phi = sign(phi);
(注意:没有任何元素phi
是零或接近零。这样,所有元素都phi
变为1
或-1
。)和
for i=1:numel(gamma)
if (abs(gamma(i))>1e-4)
G(i,:) = G(i,:)/abs(gamma(i));
gamma(i) = sign(gamma(i));
end
end
我现在得到的不可行性5.577e-07
计算为max(F*ystar-phi)
(对于更新的归一化矩阵F
和phi
)。CPLEX 是否使用内点求解器?如果是的话,应该没有任何不可行性。
更新 2:我已经上传了这个问题的数据和一个测试用例HERE。