Ejemplo n.º 1
0
void make_adjustments(int col, int row1, int row2, int n, int k, int* object, int* cv, int old_k, int* old_object, int* old_cv, int* missing, int* idx_mat)
{
    int h = n*n;
	remove_value(col, row1, n, k, object, old_k, cv, missing, idx_mat);
	remove_value(col, row2, n, k, object, old_k, cv, missing, idx_mat);
	old_remove_value(col, row1, n, k, object, old_k, old_object, old_cv, missing);
	old_remove_value(col, row2, n, k, object, old_k, old_object, old_cv, missing);
	add_value(object[col*h+row2], col, row1, n, k, object, old_k, cv, missing, idx_mat);
	add_value(object[col*h+row1], col, row2, n, k, object, old_k, cv, missing, idx_mat);
	old_add_value(object[col*h+row2], col, row1, n, k, object, old_k, old_object, old_cv, missing);
	old_add_value(object[col*h+row1], col, row2, n, k, object, old_k, old_object, old_cv, missing);
	
}
Ejemplo n.º 2
0
void random_updater::shift_var(unsigned j, interval & r) {
    SASSERT(r.contains(m_core_solver.m_r_x[j]));
    SASSERT(m_core_solver.m_r_solver.column_is_feasible(j));
    auto old_x = m_core_solver.m_r_x[j];
    remove_value(old_x);
    auto new_val = m_core_solver.m_r_x[j] = get_random_from_interval(r);
    add_value(new_val);

    SASSERT(r.contains(m_core_solver.m_r_x[j]));
    SASSERT(m_core_solver.m_r_solver.column_is_feasible(j));
    auto delta = m_core_solver.m_r_x[j] - old_x;
   
    unsigned i;
    m_column_j->reset();
    mpq a;
    while(m_column_j->next(a, i)) {
        unsigned bj = m_core_solver.m_r_basis[i];
        m_core_solver.m_r_x[bj] -= a * delta;
        SASSERT(m_core_solver.m_r_solver.column_is_feasible(bj));
    }
    SASSERT(m_core_solver.m_r_solver.A_mult_x_is_off() == false);
}