SCIP.jl
SCIP.jl is a Julia interface to the SCIP solver.
It has two components:
- a thin wrapper around the complete C API
- an interface to MathOptInterface
Affiliation
This wrapper is maintained by the SCIP project with the help of the JuMP community.
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.
License
SCIP.jl
is licensed under the MIT License.
The underlying solver, scipopt/scip, is licensed under the Apache 2.0 license.
Installation
Install SCIP using Pkg.add
:
julia> import Pkg
julia> Pkg.add("SCIP")
In addition to installing the SCIP.jl package, this will also download and install the SCIP binaries. You do not need to install SCIP separately.
Custom installations
If you want a custom SCIP installation, you must manually install the SCIP binaries.
Binaries are available for download at https://www.scipopt.org/#download.
Once the binaries are installed, set the SCIPOPTDIR
environment variable to temporarily point to the installation path (that is, depending on your operating system, $SCIPOPTDIR/lib/libscip.so
, $SCIPOPTDIR/lib/libscip.dylib
, or $SCIPOPTDIR/bin/libscip.dll
must exist). Then, install SCIP.jl
using Pkg.add
and Pkg.build
from the Julia command line:
julia> ENV["SCIPOPTDIR"] = raw"C:\Program Files\SCIPOptSuite 9.1.1" # for Windows
julia> import Pkg
julia> Pkg.add("SCIP")
julia> Pkg.build("SCIP")
Use with JuMP
Use SCIP with JuMP as follows:
using JuMP, SCIP
model = Model(SCIP.Optimizer)
set_attribute(model, "display/verblevel", 0)
set_attribute(model, "limits/gap", 0.05)
Options
See the SCIP documentation for a list of supported options.
MathOptInterface API
The SCIP optimizer supports the following constraints and attributes.
List of supported objective functions:
List of supported variable types:
List of supported constraint types:
MOI.ScalarAffineFunction{Float64}
inMOI.EqualTo{Float64}
MOI.ScalarAffineFunction{Float64}
inMOI.GreaterThan{Float64}
MOI.ScalarAffineFunction{Float64}
inMOI.Interval{Float64}
MOI.ScalarAffineFunction{Float64}
inMOI.LessThan{Float64}
MOI.ScalarNonlinearFunction
inMOI.EqualTo{Float64}
MOI.ScalarNonlinearFunction
inMOI.GreaterThan{Float64}
MOI.ScalarNonlinearFunction
inMOI.Interval{Float64}
MOI.ScalarNonlinearFunction
inMOI.LessThan{Float64}
MOI.ScalarQuadraticFunction{Float64}
inMOI.EqualTo{Float64}
MOI.ScalarQuadraticFunction{Float64}
inMOI.GreaterThan{Float64}
MOI.ScalarQuadraticFunction{Float64}
inMOI.Interval{Float64}
MOI.ScalarQuadraticFunction{Float64}
inMOI.LessThan{Float64}
MOI.VariableIndex
inMOI.EqualTo{Float64}
MOI.VariableIndex
inMOI.GreaterThan{Float64}
MOI.VariableIndex
inMOI.Integer
MOI.VariableIndex
inMOI.Interval{Float64}
MOI.VariableIndex
inMOI.LessThan{Float64}
MOI.VariableIndex
inMOI.ZeroOne
MOI.VectorAffineFunction{Float64}
inMOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.LessThan{Float64}}
MOI.VectorOfVariables
inMOI.SOS1{Float64}
MOI.VectorOfVariables
inMOI.SOS2{Float64}
List of supported model attributes:
Design considerations
Wrapping the public API
All of the public API methods are wrapped and available within the SCIP
package. This includes the scip_*.h
and pub_*.h
headers that are collected in scip.h
, as well as all default constraint handlers (cons_*.h
.)
The wrapped functions do not transform any data structures and work on the raw pointers (for example, SCIP*
in C, Ptr{SCIP_}
in Julia). Convenience wrapper functions based on Julia types are added as needed.
Memory management
Programming with SCIP requires dealing with variable and constraint objects that use reference counting for memory management.
The SCIP.Optimizer
wrapper type collects lists of SCIP_VAR*
and SCIP_CONS*
under the hood, and it releases all references when it is garbage collected itself (via finalize
).
When adding a variable (add_variable
) or a constraint (add_linear_constraint
), an integer index is returned. This index can be used to retrieve the SCIP_VAR*
or SCIP_CONS*
pointer via get_var
and get_cons
respectively.
Supported nonlinear operators
Supported operators in nonlinear expressions are as follows:
+
-
*
/
^
sqrt
exp
log
abs
cos
sin