GithubHelp home page GithubHelp logo

scip.jl's Introduction

SCIP.jl

Julia interface to SCIP solver.

Build Status Coverage Status codecov

See NEWS.md for changes in each (recent) release.

Update (March 2019)

We have completely rewritten the interface from scratch, using Clang.jl to generate wrappers based on the headers of the SCIP library. The goal is to support JuMP (from version 0.19 on) through MathOptInterface.

Currently, we support LP, MIP and QCP problems, as well as some nonlinear constraints, both through MOI sets (e.g., for second-order cones) as well as for expression graphs (see below).

It is now possible to implement SCIP constraint handlers in Julia. Other plugin types are not yet supported.

Getting Started

To use SCIP.jl, you will need SCIP installed on your system. SCIP's license does not allow (automatic) redistribution, so please download and install it yourself.

Currently, Linux, OS X and Windows are tested and supported.

We recommend using one of the provided installers, e.g., SCIPOptSuite-6.0.1-Linux.deb for systems based on Debian. Adding the SCIP.jl package should then work out of the box:

pkg> add SCIP

If you build SCIP from source you should set the environment variable SCIPOPTDIR to point the the installation path. That is, either $SCIPOPTDIR/lib/libscip.so, $SCIPOPTDIR/lib/libscip.dylib or $SCIPOPTDIR/bin/scip.dll should exist, depending on your operating system.

Setting Parameters

There are two ways of setting the parameters (all are supported). First, using MOI.set:

using MOI
using SCIP

optimizer = SCIP.Optimizer()
MOI.set(optimizer, SCIP.Param("display/verblevel"), 0)
MOI.set(optimizer, SCIP.Param("limits/gap"), 0.05)

Second, as keyword arguments to the constructor. But here, the slashes (/) need to be replaced by underscores (_) in order to end up with a valid Julia identifier. This should not lead to ambiguities as none of the official SCIP parameters contain any underscores (yet).

using MOI
using SCIP

optimizer = SCIP.Optimizer(display_verblevel=0, limits_gap=0.05)

Note that in both cases, the correct value type must be used (here, Int64 and Float64).

Design Considerations

Wrapper of Public API: All of SCIP's 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.) But the wrapped functions do not transform any data structures and work on the raw pointers (e.g. 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 constraints objects that use reference counting for memory management. SCIP.jl provides a wrapper type ManagedSCIP that collects lists of SCIP_VAR* and SCIP_CONS* under the hood, and releases all reference 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.

ManagedSCIP does not currently support deletion of variables or constraints.

Supported Features for MathOptInterface: We aim at exposing many of SCIP's features through MathOptInterface. However, the focus is on keeping the wrapper simple and avoiding duplicate storage of model data.

As a consequence, we do not currently support some features such as retrieving constraints by name (SingleVariable-set constraints are not stored as SCIP constraints explicitly).

Support for more constraint types (quadratic/SOC, SOS1/2, nonlinear expression) is implemented, but SCIP itself only supports affine objective functions, so we will stick with that. More general objective functions could be implented via a bridge.

Supported operators in nonlinear expressions are as follows:

  • unary: -, sqrt, exp, log, abs
  • binary: -, /, ^, min, max
  • n-ary: +, *

In particular, trigonometric functions are not supported.

Old Interface Implementation

A previous implementation of SCIP.jl supported JuMP (up to version 0.18) through MathProgBase. It did not interface SCIP directly, but went through CSIP, a simplified C wrapper.

Back then, the interface support MINLP problems as well as solver-indepentent callbacks for lazy constraints and heuristics.

To use that version, you need to pin the version of SCIP.jl to v0.6.1 (the last release before the rewrite):

pkg> add [email protected]
pkg> pin SCIP

scip.jl's People

Contributors

rschwarz avatar matbesancon avatar fserra avatar ayush-iitkgp avatar mlubin avatar tkoolen avatar chkwon avatar joaquimg avatar yankaicao avatar juliatagbot avatar isoron avatar femtocleaner[bot] avatar odow avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.