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

problem with Convex and new SCS (0.8.1) #466

Closed
PaulSoderlind opened this issue Nov 12, 2021 · 7 comments · Fixed by #467
Closed

problem with Convex and new SCS (0.8.1) #466

PaulSoderlind opened this issue Nov 12, 2021 · 7 comments · Fixed by #467

Comments

@PaulSoderlind
Copy link
Contributor

Julia 1.6.3, Win 10

example from SCS page:

using Convex, SCS
items  = [:Gold, :Silver, :Bronze]
values = [5.0, 3.0, 1.0]
weights = [2.0, 1.5, 0.3]

x = Variable(3)
p = maximize(x' * values, 0 <= x, x <= 1, x' * weights <= 3)
solve!(p, SCS.Optimizer)

gives

ERROR: LoadError: MethodError: no method matching solve!(::Problem, ::Type{SCS.Optimizer})                                  
Closest candidates are:                                       
  solve!(::Problem; warmstart, check_vexity, verbose) at C:\Users\psoderlind\.julia\packages\Convex\6NNC8\src\solution.jl:16  solve!(::Problem, ::MathProgBase.SolverInterface.AbstractMathProgSolver; kwargs...) at ...
@ericphanson
Copy link
Collaborator

I'm guessing this is a compatability issue: SCS v0.8.1 is using MOI v0.10, and Convex only supports MOI v0.9 currently. The package resolver has likely handled this by reverting to a very old version of Convex that doesn't use MOI at all, so there is no declared incompatability between the two, but in practice they aren't interoperable.

The current workaround would be to use an older version of SCS until Convex is updated.

#454 would update Convex, but I'm not sure if we need code changes or just a compat bump.

@PaulSoderlind
Copy link
Contributor Author

PaulSoderlind commented Nov 12, 2021

reverting to a very old version of Convex

Indeed, I now see that I have been downgraded to Convex v0.12.5...

@PaulSoderlind
Copy link
Contributor Author

but I'm not sure if we need code changes or just a compat bump.

I tried a compat bump, but got errors on my first attempt to run Convex. The error message started with

ERROR: LoadError: TypeError: in ObjectiveFunction, in F, expected F<:MathOptInterface.AbstractScalarFunction, got a value of type typeof(MathOptInterface.SingleVariable)

@ericphanson
Copy link
Collaborator

ericphanson commented Nov 12, 2021

Yeah, I bumped #454 and saw that in the logs there too: https://github.com/jump-dev/Convex.jl/runs/4189678272?check_suite_focus=true#step:6:10423. The breaking changes are listed here: https://jump.dev/MathOptInterface.jl/latest/release_notes/#Breaking-changes-in-MOI. I think the issue might be SingleVariable has been removed; use VariableIndex instead, and the line in Convex here:

MOI.set(model, MOI.ObjectiveFunction{MOI.SingleVariable}(), MOI.SingleVariable(objective_index))

We also use SingleVariable a few other places in that function. Possibly @odow can advise us on the fix?

@odow
Copy link
Member

odow commented Nov 12, 2021

There are a large number of breaking changes in MOI 0.10.

This particular line becomes

MOI.set(model, MOI.ObjectiveFunction{MOI.VariableIndex}(), objective_index)

But there are many more changes than just the removal of SingleVariable.

@PaulSoderlind
Copy link
Contributor Author

Great. Seems to work well. Thanks for your efforts. /Paul S

@ericphanson
Copy link
Collaborator

Awesome, thanks for checking! I'll tag Convex v0.14.17 once #468 is merged and then we should be able to support both versions of MOI, which will hopefully make things easier.

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.

3 participants