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

MethodError when setting PresolveType and SolveType through MOI #91

Closed
mtanneau opened this issue May 27, 2020 · 1 comment · Fixed by #92
Closed

MethodError when setting PresolveType and SolveType through MOI #91

mtanneau opened this issue May 27, 2020 · 1 comment · Fixed by #92

Comments

@mtanneau
Copy link
Contributor

The following used to work but now results in a MethodError:

import Clp
import MathOptInterface
const MOI = MathOptInterface

clp = Clp.Optimizer()

MOI.set(clp, MOI.RawParameter("SolveType", 4))     # errors
MOI.set(clp, MOI.RawParameter("PresolveType", 1))  # also errors

I did not see any other other case where the following

Error message:

ERROR: MethodError: no method matching ClpSolve_setSolveType(::Ptr{Nothing}, ::Int64)
Closest candidates are:
  ClpSolve_setSolveType(::Any, ::Any, ::Any) at /mnt/c/Users/mathi/Git/Clp.jl/src/gen/libclp_api.jl:593
Stacktrace:
 [1] set(::Clp.Optimizer, ::MathOptInterface.RawParameter, ::Int64) at /mnt/c/Users/mathi/Git/Clp.jl/src/MOI_wrapper/MOI_wrapper.jl:101
 [2] top-level scope at REPL[5]:1

There are at least 3 ways of fixing this. PR incoming.

@mtanneau
Copy link
Contributor Author

A bit more about why the error happens:

The call MOI.set(clp, MOI.RawParameter("SolveType", 4)) ends up calling ClpSolve_setSolveType(model.solver_options, 4).
The error is then raised because the signature of ClpSolve_setSolveType is

ClpSolve_setSolveType(arg1, method, extraInfo)

(same for ClpSolve_setPresolveType)

According to this, passing extraInfo = -1 results in default behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant