Skip to content

After several iterations, and with update only, lower/upper bounds appear swapped #215

@fp018

Description

@fp018

Description

I’m using OsqpEigen to solve a QP repeatedly in a loop. The solver is initialized once and, at each iteration, I update only the constraint matrix A and the bounds (lb, ub).

The solver fails with:

ERROR in validate_data: Lower bound at index 0 is greater than upper bound: 1.0000e+00 > -1.0000e+00
ERROR in osqp_setup: Problem data validation.
[OsqpEigen::Solver::initSolver] Unable to setup the workspace.
[OsqpEigen::Solver::updateLinearConstraintsMatrix] Unable to Initialize the solver.

These numbers match the values I pass to updateBounds, but they appear swapped: the intended lower bound should be -1 and the upper bound 1.
This happens at the second iteration or after several iterations, depending on the problem formulation.

The periodical update is

Eigen::Matrix<c_float, -1, 1> ub_f = ub.cast<c_float>();
Eigen::Matrix<c_float, -1, 1> lb_f = lb.cast<c_float>();

if (!solver.updateLinearConstraintsMatrix(A_s)) return false;
if (!solver.updateBounds(lb_f, ub_f)) return false;

Environment:

OsqpEigen version: v0.10.3

OSQP version: v1.0.0

They are both compiled from source code, and OSQP with -DOSQP_USE_FLOAT=ON. I have used the same approach before with an older version of the library, and it worked fine.

Thanks in advance for any help or suggestions!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions