# Querying the dual variables associated to variable bounds

When solving a linear program with lower and upper bounds on a variable, i.e., `l <= x <= u`, is there a way to access the dual variables associated to each bound constraint separately? (here `x` denotes a single scalar variable).

Specifically, I would like to access the dual of `l <= x` and the dual of `x <= u`, which I'll denote `s_l` and `s_u`, respectively.

It's my understanding that Gurobi only gives access to the reduced cost of `x`, which corresponds to `s_l + s_u`. The question thus becomes: if there is no way to access `s_l` and `s_u`, directly, what would be the recommended way to recover them from the reduced cost of `x`?

The potentially problematic cases would include (in addition to numerical tolerances and finite precision arithmetic):

* solving the LP with interior-point + no crossover, with relaxed tolerance on optimality gap. In that case, strict complementarity may not hold.

* the lower and upper bound are equal. In that case, both bounds are tight.

Currently, we have considered two approaches (see the discussion here).

1) check if the bound is active. If yes, return the reduced cost. If not, return 0.

2) check the sign of the reduced cost. If positive, the lower bound is active. If negative, the upper bound is active.

If there's any better alternative, I'd be happy to hear.

Please sign in to leave a comment.

## Comments

0 comments