我正在使用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。
答案 0 :(得分:2)
参数collabopt.tolerance适用于collabOpt,它是一个单独的算法,用于调试模型,不会影响优化器。您需要参数EpRhs,该参数确定在最佳解决方案中可以违反多少约束。 您可以使用cplexoptimset('EpRhs',1e-6')来设置参数。