scipopt / SCIP.jl

Julia interface to SCIP solver
MIT License
98 stars 24 forks source link
global-optimization hacktoberfest julia mixed-integer-linear-programming mixed-integer-optimization mixed-integer-programming nonlinear-optimization

SCIP.jl

Build Status codecov

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

SCIP cannot be installed automatically on Windows. See the "Custom installation" instructions below.

Install SCIP using Pkg.add:

julia> import Pkg

julia> Pkg.add("SCIP")

On platforms other than Windows, 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.

Windows and custom installations

If you use Windows, or 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:

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: