LinQuadOptInterface.jl icon indicating copy to clipboard operation
LinQuadOptInterface.jl copied to clipboard

Farkas duals for variable bounds

Open odow opened this issue 6 years ago • 4 comments

Currently we only get the farkas dual for constraints:

https://github.com/JuliaOpt/LinQuadOptInterface.jl/blob/d6957f357227e692c0e15bd6c64e9d0a37b7b1f1/src/solve.jl#L58

However, linear12 needs it for variable bounds.

odow avatar Jul 30 '18 02:07 odow

I talked about this with @blegat once. Part of the problem is due to the fact that xpress gurobi and cplex only return data for constraints. They ignore bounds. We can have a method for computing that.

joaquimg avatar Jul 30 '18 02:07 joaquimg

Yes, this is the dual analogous to computing the ConstraintPrimals using the VariablePrimals and the ConstraintFunctions

blegat avatar Jul 30 '18 06:07 blegat

I don't really know what I'm talking about, but for the linear case, it seems we just need a matrix multiplication: https://orinanobworld.blogspot.com/2011/07/farkas-certificates-in-cplex.html

get_farkas_dual!(m, m.constraint_dual_solution)
A = get_constraint_matrix(m)  # doesn't exist
m.variable_dual_solution .= m.constraint_dual_solution' * A
# plus some +/- corrections

It seems we have two options

  1. add a get_constraint_matrix(model) method
  2. add a get_farkas_dual_variables!(model, m.variable_dual_solution) method 2a. with a fallback that loops through the linear constraints querying the constraint functions.

odow avatar Aug 01 '18 05:08 odow

basic infra structure is on #59 should we close?

joaquimg avatar Sep 05 '18 02:09 joaquimg