Skip to content

Last round of renaming #203

@mlubin

Description

@mlubin

Now that we've mostly settled on the MOI/MOIU/JuMP API structure, it's time to rename the different components to match what they do. Last time we do this before MOI is released.

Let's list the things we have:

  • supports-MOI-interface describes a type that implements the MOI interface for specifying problems, i.e., addvariable!, addconstraint!, copy!. There are different levels of support, i.e., copy-only, 2-pass load, and general addconstraint!.
  • data-with-optimize! is a supports-MOI-interface object that lets you call optimize!. The data are usually stored and owned directly by the solver.
  • data-without-optimize! is a supports-MOI-interface object that does not support optimize!. It just stores the problem data.
  • data-with-optimize!-plus-caching is a supports-MOI-interface object that lets you attach and synchronize with a data-with-optimize!. It stores an extra copy of the data and deals with the case of the data-with-optimize! not supporting the full MOI interface by re-copying the data to the solver when needed. In "automatic" mode, a data-with-optimize!-plus-caching can act exactly like a data-with-optimize! (Supertype of InstanceManager is AbstractSolverInstance JuliaOpt/MathOptInterfaceBridges.jl#65). In "manual" mode it gives more control over when copies happen, and you can't naively use it as a drop-in for data-with-optimize!.
  • optimize!-attributes are gettable/settable attributes related to how optimize! works like stopping limits, solution methods, and the name of the solver (Add SolverName #201). These are dropped on copy!
  • data-attributes are essential parts of the data specification (names, VariablePrimalStart, NLPBlock) that cannot be dropped on copy!.
  • result-attributes are properties of the result computed by optimize!. I don't think we've discussed if they can be dropped on copy or not.

JuMP provides a frontend to any supports-MOI-instance object depending on what its moibackend field is set to. The default use case is for JuMP to be a frontend fordata-with-optimize!-plus-caching.

Currently:

  • supports-MOI-interface is AbstractInstance
  • data-with-optimize! is AbstractSolverInstance
  • data-without-optimize! is AbstractStandaloneInstance
  • data-with-optimize!-plus-caching is InstanceManager
  • Attributes are a mix of AbstractSolverParameter and AnyAttribute (Add SolverName #201).

I'm going to throw out a couple questions to start the discussion. I don't have a full proposal yet, but hopefully this summary above will get everyone on the same page on the layout of the abstractions. I'd like to brainstorm and make a decision on this quickly so that we can make this change and move on!

Question 1: Looking at this now, the definition of data-without-optimize is a bit strange. Usually we don't define objects by what they don't support. Should we just remove this concept in favor of supports-MOI-interface? If we need to dispatch on data-with-optimize! and data-without-optimize! we can dispatch instead between data-with-optimize! and supports-MOI-interface.

Question 2: Do we want to call data-with-optimize! AbstractSolver? A documentation-level definition of a solver could be:

"A solver implements the MOI interface for loading problem data and supports optimize!".

This has a downside of being completely different from MPB's definition of a solver, but that's not a blocker. In the data-with-optimize!-plus-caching I found it convenient to talk about the "solver" and the "instance":

https://github.com/JuliaOpt/MathOptInterfaceUtilities.jl/blob/d9d1c4f20b1667e440b2a54831fefe8a117e433a/src/instancemanager.jl#L12

Note that any use of "solver" in MOI should be consistent with the use of solver= in JuMP.

Question 3: Can we make JuMP's Model somehow consistent with the MOI naming convention? JuMP is now essentially a nice interface to any supports-MOI-interface object. That would suggest picking a name for supports-MOI-interface that's similar to JuMP's Model, or renaming JuMP's Model.

@blegat @odow @joaquimg @chriscoey @joehuchette @ccoffrin @IssamT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions