Skip to content

Testing of the MOI wrapper #9

Description

@odow

I have many comments on the MOI wrapper, but there's a little hard to go through until the tests are passing. Fixing the tests should resolve most of my comments.

Functions like this strongly suggest that we're not testing the MOI wrapper correctly because it doesn't account for the different dual conventions between JuMP and Xpress:

function MOI.get(model::Optimizer, result_index::MOI.ConstraintDual, indices::Vector{MOI.ConstraintIndex{F,S}})::Vector{Precision} where {
F <: MOI.AbstractFunction, S <: MOI.AbstractSet
}
@assert result_index.result_index == 1
return map(index -> begin
c = _XPRS_constraint_from_moi_index(model, index)
if c.xprs_index == -2 # Variable bounds are set as constraints with xprs index -2
return NaN
end
# (so are parent constraints)
if length(c.subconstraints) > 0 # Variable bounds are set as constraints with xprs index -2
return map(subc -> NaN, c.subconstraints)
end
solstatus, solvec = XPRSgetduals(model.inner, c.solbuffer, c.xprs_index, c.xprs_index)
if solstatus == XPRS_SOLAVAILABLE_NOTFOUND
return NaN
end
return solvec[1]
end,
indices
)
end

In particular, we should be calling MOI.Test.runtests with minimal exclusions. Here's Xpress.jl:

https://github.com/jump-dev/Xpress.jl/blob/3f08ab203011da3375c1dd1af72cbb16c40b00bf/test/test_MOI_wrapper.jl#L47-L68

Here's how we handle duals in Xpress.jl:

https://github.com/jump-dev/Xpress.jl/blob/3f08ab203011da3375c1dd1af72cbb16c40b00bf/src/MOI/MOI_wrapper.jl#L3327-L3401

Note also our convention when there is a dual unbounded ray.

For our duality conventions, see https://jump.dev/MathOptInterface.jl/stable/background/duality/

For our infeasibility certificate conventions, see https://jump.dev/MathOptInterface.jl/stable/background/infeasibility_certificates/

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