Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test getting VariablePrimalStart #794

Closed
odow opened this issue Jul 16, 2019 · 3 comments
Closed

Test getting VariablePrimalStart #794

odow opened this issue Jul 16, 2019 · 3 comments

Comments

@odow
Copy link
Member

odow commented Jul 16, 2019

See: https://discourse.julialang.org/t/warning-invalid-warm-start-basis-discarded/26403/2
See: jump-dev/Gurobi.jl#225

We should add a test like the following to MOIT.

model = Gurobi.Optimizer()
x = MOI.add_variables(model, 3)
MOI.set(
    model, 
    MOI.ObjectiveFunction{MOI.ScalarAffineFunction{Float64}}(), 
    MOI.ScalarAffineFunction(
        MOI.ScalarAffineTerm.(1.0, x),
        0.0
    )
)
MOI.add_constraint(model, MOI.SingleVariable(x[2]), MOI.GreaterThan(1.0))
MOI.set(model, MOI.VariablePrimalStart(), x[1], 1.0)
MOI.set(model, MOI.VariablePrimalStart(), x[2], 0.0)
MOI.set(model, MOI.VariablePrimalStart(), x[3], 2.0)
@test MOI.get.(model, MOI.VariablePrimalStart(), x) == [1.0, 0.0, 2.0]

MOI.set(model, MOI.VariablePrimalStart(), x[2], nothing)
@test MOI.get.(model, MOI.VariablePrimalStart(), x) == [1.0, nothing, 2.0]
@QunLin0
Copy link

QunLin0 commented Jul 20, 2019

I got the following message with the above code (noting that I use @show, instead of @test):

Warning, invalid warm-start basis discarded

ArgumentError: ModelLike of type Gurobi.Optimizer does not support accessing the attribute MathOptInterface.VariablePrimalStart()

@odow
Copy link
Member Author

odow commented Jul 21, 2019

@QunLin0, correct. The reason to add these tests is so that the solvers will all support them. At present, we aren't testing setting warm-starts properly, which is why some solvers haven't implemented them correctly.

@odow
Copy link
Member Author

odow commented Dec 14, 2020

Closed by #1136

@odow odow closed this as completed Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants