Skip to content

Add support to query the reduced cost of a variable #776

@mtanneau

Description

@mtanneau

Querying the reduced cost of a variable is very common in linear programming (and the corresponding function is in all linear solvers' APIs), however there is no straightforward way of doing this through MOI.
Currently, to access the reduced cost of a variable x, one has to manually query the dual value of every possible bound constraint on x (if any), and aggregate the results.
That's very cumbersome, given that this feature is supported by all linear solvers.

Proposal:
Add a variable attribute to query the reduced cost of a variable, e.g. ReducedCost, or (more verbose) VariableReducedCost. For now, this would only apply to linear programming solvers (see list below).

The syntax would look like:

MOI.get(model, MOI.ReducedCost(), x)

Solvers wrappers to be updated:

If it makes sense, support could be extended to non-linear solvers as well.

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