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

Heuristic callback with non-Float64 #2290

Closed
blegat opened this issue Jul 19, 2020 · 2 comments · Fixed by #2319
Closed

Heuristic callback with non-Float64 #2290

blegat opened this issue Jul 19, 2020 · 2 comments · Fixed by #2319
Labels
good first issue This issue is recommended for new users, it does not require a thorough understanding of the package Status: Help Wanted Help is welcome on this issue

Comments

@blegat
Copy link
Member

blegat commented Jul 19, 2020

We could add a method that does not require Float64 and does the conversion to:

values::Vector{Float64}

See https://discourse.julialang.org/t/how-to-define-a-heuristic-callback-using-jump/43322/2

@blegat blegat added good first issue This issue is recommended for new users, it does not require a thorough understanding of the package Status: Help Wanted Help is welcome on this issue JuMP Development Sprint labels Jul 19, 2020
@odow
Copy link
Member

odow commented Jul 19, 2020

Probably just

function MOI.submit(
    model::Model,
    cb::MOI.HeuristicSolution,
    variables::Vector{VariableRef},
    values::Vector{<:Real}
)
    return MOI.submit(backend(model), cb, index.(variables), Float64.(values))
end

Or we just relax the signature here and force the solvers to accept <:Real. There are only 3 (Gurobi, CPLEX, and GLPK).

@blegat
Copy link
Member Author

blegat commented Jul 19, 2020

We probably want to avoid the broadcast in case it's already Float64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue This issue is recommended for new users, it does not require a thorough understanding of the package Status: Help Wanted Help is welcome on this issue
Development

Successfully merging a pull request may close this issue.

2 participants