Skip to content

Commit

Permalink
fix preconditioner tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RSchwan committed Mar 2, 2024
1 parent 8f93dc0 commit 60dc1d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions include/piqp/utils/random_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,14 @@ dense::Model<T> dense_strongly_convex_qp(isize dim, isize n_eq, isize n_ineq,
}

Vec<T> c = vector_rand<T>(dim);
Vec<T> b = A * x_sol;
Vec<T> h = G * x_sol + delta;
Vec<T> b(n_eq);
if (n_eq > 0) {
b = A * x_sol;
}
Vec<T> h(n_ineq);
if (n_ineq > 0) {
h = G * x_sol + delta;
}

Vec<T> x_lb = Vec<T>::Constant(dim, -std::numeric_limits<T>::infinity());
Vec<T> x_ub = Vec<T>::Constant(dim, std::numeric_limits<T>::infinity());
Expand Down
4 changes: 2 additions & 2 deletions tests/src/preconditioner_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ TEST(RuizEquilibration, DenseSameIneqScaling)
h(data_box.n_lb + i) = data_box.x_ub(i);
}

dense::Model<T> qp_model_ineq(qp_model_box.P, qp_model_box.A, G,
qp_model_box.c, qp_model_box.b, h,
dense::Model<T> qp_model_ineq(qp_model_box.P, qp_model_box.c,
qp_model_box.A, qp_model_box.b, G, h,
Vec<T>::Constant(dim, -std::numeric_limits<T>::infinity()),
Vec<T>::Constant(dim, std::numeric_limits<T>::infinity()));
dense::Data<T> data_ineq(qp_model_ineq);
Expand Down

0 comments on commit 60dc1d7

Please sign in to comment.