MathOptLazy.jl
MathOptLazy.jl is a meta-solver for problems with lazy constraints.
License
MathOptLazy.jl is licensed under the MIT License.
Getting help
If you need help, please ask a question on the JuMP community forum.
If you have a reproducible example of a bug, please open a GitHub issue.
Installation
Install MathOptLazy using Pkg.add:
import PkgPkg.add("MathOptLazy")Use with JuMP
Use MathOptLazy.jl with JuMP as follows:
using JuMPimport HiGHSimport MathOptLazy# Pass () -> MathOptLazy.Optimizer(inner_optimizer) as the solvermodel = Model(() -> MathOptLazy.Optimizer(HiGHS.Optimizer))# Choose an algorithmset_attribute(model, MathOptLazy.Algorithm(), MathOptLazy.Iterative())@variable(model, x[1:10] >= 0)# Tag constraints as lazy@constraint(model, [i in 1:10], x[i] <= 1, MathOptLazy.Lazy())# You can also pass the `lazy` keyword to Lazy()is_lazy = rand(Bool)@constraint(model, sum(x) <= 3, MathOptLazy.Lazy(; lazy = is_lazy))# You can also use this constructor to opt-in to lazy constraints of the given# type if and only if the solver supports them. This simplifies writing a model# where the user gets to choose the solver.tag = MathOptLazy.Lazy(model, AffExpr, MOI.GreaterThan{Float64})@constraint(model, sum(x) >= 2, tag)Algorithm
Control the algorithm used to handle the lazy constraints by setting the MathOptLazy.Algorithm attribute. See the docstring for details. The supoprted values are:
MathOptLazy.Iterative()[default]MathOptLazy.Callback()MathOptLazy.SolverSpecific()
See their docstrings for details.