我使用CPLEX API在MATLAB上運行CPLEX(版本125)。我試圖解決一個約束二次規劃問題,並且我正在陷入一個原始的不可行性。特別是,該問題的MATLAB代碼是:CPLEX原始不可行性
[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
然而,通過cplexqcp
返回的溶液ystar
使得:
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。
關於如何在MATLAB中改變這個任何想法? –
我試過了,但沒有奏效......'cplexoptimset'不支持這個選項(我也試過用小寫字母)。 –
@PantelisSopasakis嘗試ops.simplex.tolerances.feasibility = 1e-7 –