Modeling and solving
Ideally, given a problem, one just want to model and solve. That is what LocalSearchSolvers is aiming for. Here we only provide JuMP syntax.
Model
using CBLS, JuMP
model = Model(CBLS.Optimizer) # CBLS is an exported alias of LocalSearchSolvers
# add variables (cf Variables section)
# add constraints (cf Constraints section)
# add objective (cf Objectives section)
Solver
# run the solver. If no objectives are provided, it will look for a satisfying solution and stop
optimize!(model)
# extract the values (assuming X, a (collection of) variable(s) is the target)
solution = value.(X)
Solver options
LocalSearchSolvers.Options
— TypeOptions()
Arguments:
dynamic::Bool
: is the model dynamic?iteration::Union{Int, Float64}
: limit on the number of iterationsprint_level::Symbol
: verbosity to choose among:silent
,:minimal
,:partial
,:verbose
solutions::Int
: number of solutions to returnspecialize::Bool
: should the types of the model be specialized or not. Usually yes for static problems. For dynamic in depends if the user intend to introduce new types. The specialized model is about 10% faster.tabu_time::Int
: DESCRIPTIONtabu_local::Int
: DESCRIPTIONtabu_delta::Float64
: DESCRIPTIONthreads::Int
: Number of threads to usetime_limit::Float64
: time limit in seconds- `function Options(; dynamic = false, iteration = 10000, printlevel = :minimal, solutions = 1, specialize = !dynamic, tabutime = 0, tabulocal = 0, tabudelta = 0.0, threads = typemax(0), time_limit = Inf)
# Setting options in JuMP syntax: print_level, time_limit, iteration
model = Model(CBLS.Optimizer)
set_optimizer_attribute(model, "iteration", 100)
set_optimizer_attribute(model, "print_level", :verbose)
set_time_limit_sec(model, 5.0)