mirror of https://github.com/CGAL/cgal
- fixed validity check (unboundedness)
This commit is contained in:
parent
90b3b616a0
commit
fff7f6a07e
|
|
@ -2034,8 +2034,7 @@ z_replace_variable_original_by_original_upd_w_r(Tag_false )
|
|||
update_r_C_r_S_B__j_i(x_j, x_i);
|
||||
|
||||
// replace r_beta_O(i) with w_j
|
||||
if (!check_tag(Is_linear())) // (kf.)
|
||||
r_B_O[in_B[i]] = w[j];
|
||||
r_B_O[in_B[i]] = w[j];
|
||||
|
||||
// update x_O_v_i
|
||||
x_O_v_i[j] = BASIC;
|
||||
|
|
@ -2542,7 +2541,7 @@ check_r_C(Tag_false) const
|
|||
{
|
||||
Values t_r_C;
|
||||
// compute t_r_C from scratch
|
||||
t_r_C.insert(t_r_C.end(), C.size(), et0);
|
||||
t_r_C.resize(C.size(), et0);
|
||||
multiply__A_CxN_O(t_r_C.begin());
|
||||
|
||||
// compare r_C and the from scratch computed t_r_C
|
||||
|
|
@ -2573,7 +2572,7 @@ check_r_S_B(Tag_false) const
|
|||
{
|
||||
Values t_r_S_B;
|
||||
// compute t_r_S_B from scratch
|
||||
t_r_S_B.insert(t_r_S_B.end(), S_B.size(), et0);
|
||||
t_r_S_B.resize(S_B.size(), et0);
|
||||
multiply__A_S_BxN_O(t_r_S_B.begin());
|
||||
|
||||
// compare r_S_B and the from scratch computed t_r_S_B
|
||||
|
|
@ -2633,7 +2632,7 @@ check_r_B_O(Tag_false) const
|
|||
{
|
||||
Values t_r_B_O;
|
||||
// compute t_r_B_O from scratch
|
||||
t_r_B_O.insert(t_r_B_O.end(), B_O.size(), et0);
|
||||
t_r_B_O.resize(B_O.size(), et0);
|
||||
multiply__2D_B_OxN_O(t_r_B_O.begin());
|
||||
|
||||
// compare r_B_O and the from scratch computed t_r_B_O
|
||||
|
|
@ -2664,7 +2663,7 @@ check_w(Tag_false) const
|
|||
{
|
||||
Values t_w;
|
||||
// compute t_w from scratch
|
||||
t_w.insert(t_w.end(), qp_n, et0);
|
||||
t_w.resize( qp_n, et0);
|
||||
multiply__2D_OxN_O(t_w.begin());
|
||||
|
||||
// compare w and the from scratch computed t_w
|
||||
|
|
|
|||
|
|
@ -577,28 +577,22 @@ bool QP_solver<Rep_>::is_solution_unbounded()
|
|||
has_finite_upper_bound(i) && w[i] < et0)
|
||||
return false;
|
||||
|
||||
// check unboundedness w^TDw=0 (C11):
|
||||
Values Dw(qp_n, et0); // Note: will be reused for (C12) below.
|
||||
if (!check_tag(Is_linear())) {
|
||||
for (int i=0; i<qp_n; ++i)
|
||||
// check unboundedness 2 Dw=0 (C11):
|
||||
if (!check_tag(Is_linear()))
|
||||
for (int i=0; i<qp_n; ++i) {
|
||||
ET sum = et0;
|
||||
D_pairwise_accessor twoD(qp_D,i);
|
||||
for (int j=0; j<qp_n; ++j)
|
||||
Dw[j] += w[i] * qp_D[j][i];
|
||||
ET sum = et0; // will hold w^T * Dw...
|
||||
for (int i=0; i<qp_n; ++i)
|
||||
sum += w[i] * Dw[i];
|
||||
if (sum != et0)
|
||||
return false;
|
||||
}
|
||||
|
||||
// check unboundedness (c^T+2x^TD)w > 0 (C12):
|
||||
ET m1 = et0, m2 = et0;
|
||||
Value_const_iterator x_it = x_B_O.begin();
|
||||
sum += w[j] * twoD(j);
|
||||
if (sum != et0)
|
||||
return false;
|
||||
}
|
||||
|
||||
// check unboundedness c^Tw > 0 (C12):
|
||||
ET m = et0;
|
||||
for (int i=0; i<qp_n; ++i)
|
||||
m1 += x[i] * Dw[i];
|
||||
m1 *= et2; // Note: m1 contains 2x^TDw*d (and not 2x^TDw).
|
||||
for (int i=0; i<qp_n; ++i)
|
||||
m2 += w[i] * qp_c[i];
|
||||
if (m2*d + m1 <= et0)
|
||||
m += w[i] * qp_c[i];
|
||||
if (m <= et0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue