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

Packaging of Mosek + MOI #168

Closed
blegat opened this issue Feb 8, 2019 · 10 comments
Closed

Packaging of Mosek + MOI #168

blegat opened this issue Feb 8, 2019 · 10 comments

Comments

@blegat
Copy link
Contributor

blegat commented Feb 8, 2019

Currently, to use Mosek with JuMP master, the user needs to do

using MathOptinterfaceMosek
model = Model(with_optimizer(MosekOptimizer))

while for any other solver, it is

using Solver
model = Model(with_optimizer(Solver.Optimizer))

This lack of consistency makes Mosek less convenient to use for JuMP users.
I understand that having a separate package for the Mosek API and for the Mosek implementation of MOI is appropriate (as discussed in JuliaOpt/MathOptInterfaceMosek.jl#34 (comment)).
However, we could have them separate while still allowing Mosek.Optimizer to be an MOI optimizer.
I see two options for that:

  1. have three packages: MosekInterface.jl (Mosek API access), MathOptInterfaceMosek.jl (Mosek with MOI) and Mosek.jl (basically just loads the two other ones)
  2. have two packages: MosekInterface.jl (Mosek API access), Mosek.jl (Mosek with MOI)

@ulfworsoe What do you think ?

@ulfworsoe
Copy link
Member

I would be very sorry to change Mosek.jl as the low-level API name since this is consistent with all namespace/module naming in all other MOSEK interfaces, and it would break existing code using the low-level interface.

MathOptInterfaceMosek.jl was chosen only because the early versions of other interfaces did something similar, so I am not married to that. As alternative names I would suggest

  • JLMosek, corresponding to the naming of our RMosek package
  • MosekTools which is the official name for the package (e.g. of you download the mosek package)

@odow
Copy link
Contributor

odow commented Feb 21, 2019

In Mosek.jl define

function Optimizer(args...; kwargs...)
    error("To use Mosek with JuMP (or MathOptInterface), you need to import ",
          "the package `MosekTools` (via `import MosekTools`). You may need ",
          "to first install it via `import Pkg; Pkg.add("MosekTools")`.")
end

Then MosekTools can overload Mosek.Optimizer and everything will work. Users still get to use Mosek.Optimizer, the api's are split, and no weird MathOptInterfaceMosek.

@blegat
Copy link
Contributor Author

blegat commented Feb 21, 2019

@ulfworsoe MosekTools looks better indeed. It is the name if you download the package from where ?
@odow I like the idea (although, strictly speaking, this is type-piracy).

@ulfworsoe
Copy link
Member

@blegat The name of the binary Mosek package is mosektools[platform] and the MOSEK solver and associated functionality are called "MOSEK Tools" (as apposed to Toolbox, which is the MATLAB API).
@odow That looks like a creative solution we will never regret. I approve!

@odow
Copy link
Contributor

odow commented Feb 21, 2019

@blegat is right though. You will get an annoying "Method overwritten warning".

You should probably add the following to Mosek.jl

function Optimizer(args...; kwargs...)
    error("To use Mosek with JuMP (or MathOptInterface), you need to use ",
          "`MosekTools.Optimizer` instead of `Mosek.Optimizer`. You can ",
          "install `MosekTools` via `import Pkg; Pkg.add("MosekTools")`.")
end

and then define MosekTools.Optimizer() which is the proper optimizer.

@blegat
Copy link
Contributor Author

blegat commented Feb 21, 2019

You won't get a warning if the signature is more specific, e.g. Mosek.Optimizer(; kws...) which is more specific as it does not have any positional arg

@blegat
Copy link
Contributor Author

blegat commented Feb 22, 2019

The approach seems to work. So the plan is

  1. Merge Add MOI Optimizer #171
  2. Tag Mosek v0.9.9
  3. Merge Extend Mosek.Optimizer JuliaOpt/MathOptInterfaceMosek.jl#69
  4. Rename MathOptInterfaceMosek to MosekTools
  5. Tag MosekTools v0.6.0

Sounds good ?

@odow
Copy link
Contributor

odow commented Feb 22, 2019

Are you sure? Have you tested to see if there is a conflict? What happens with Mosek.Optimizer()? That seems ambiguous to me...

@blegat
Copy link
Contributor Author

blegat commented Feb 22, 2019

Yes, you can test it with Mosek#master and MathOptInterfaceMosek#master, it works without warning. See also this minimal example

julia> f() = 1
f (generic function with 1 method)

julia> f(args...) = 2
f (generic function with 2 methods)

julia> f()
1

julia> f(:a)
2

@blegat
Copy link
Contributor Author

blegat commented Feb 26, 2019

MosekTools has just been released

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

No branches or pull requests

3 participants