SCIP.jl
SCIP.jl is a Julia interface to the SCIP solver.
Affiliation
This wrapper is maintained by the SCIP project with the help of the JuMP community.
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.jl using Pkg.add
:
import Pkg
Pkg.add("SCIP")
On MacOS and Linux, installing the SCIP Julia package will work out of the box and install the SCIP_jll.jl
and SCIP_PaPILO_jll.jl
dependencies.
On Windows, a separate installation of SCIP is still mandatory, as detailed in the "Custom installation" section below.
Custom installations
If you use an older Julia version, Windows, or you want a custom SCIP installation, you must manually install the SCIP binaries.
Once installed, set the SCIPOPTDIR
environment variable to point to the installation path, that is, depending on your operating system, $SCIPOPTDIR/lib/libscip.so
, $SCIPOPTDIR/lib/libscip.dylib
, or $SCIPOPTDIR/bin/scip.dll
must exist.
Then, install SCIP.jl
using Pkg.add
and Pkg.build
:
ENV["SCIPOPTDIR"] = "/Users/Oscar/code/SCIP"
import Pkg
Pkg.add("SCIP")
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.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.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