|  | 
| 1 | 1 | # SCIP.jl | 
|  | 2 | + | 
| 2 | 3 | Julia interface to [SCIP](http://scip.zib.de) solver. | 
| 3 | 4 | 
 | 
| 4 | 5 | [](https://travis-ci.org/SCIP-Interfaces/SCIP.jl) | 
| 5 | 6 | [](https://coveralls.io/github/SCIP-Interfaces/SCIP.jl?branch=master) | 
| 6 | 7 | [](https://codecov.io/gh/SCIP-Interfaces/SCIP.jl) | 
| 7 | 8 | 
 | 
| 8 |  | -## Related Projects | 
| 9 |  | - | 
| 10 |  | -- [SCIP](http://scip.zib.de): actual solver (implemented in C) that is wrapped | 
| 11 |  | -  for Julia. | 
| 12 |  | -- [CSIP](https://github.com/SCIP-Interfaces/CSIP): restricted and simplified C | 
| 13 |  | -  interface to SCIP which our wrapper is based on. | 
| 14 |  | -- [SCIP.jl](https://github.com/ryanjoneil/SCIP.jl): previous attempt to | 
| 15 |  | -  interface SCIP from Julia, using autogenerated wrapper code for all public | 
| 16 |  | -  functions. | 
| 17 |  | -- [MathProgBase](https://github.com/JuliaOpt/MathProgBase.jl): We aim to | 
| 18 |  | -  implement MPB's abstract solver interfaces, so that one can use SCIP.jl | 
| 19 |  | -  through [JuMP](https://github.com/JuliaOpt/JuMP.jl). For now, the | 
| 20 |  | -  `LinearQuadraticModel` interface is implemented, supporting lazy constraint | 
| 21 |  | -  and heuristic callbacks. | 
| 22 |  | - | 
| 23 |  | -## Installation | 
| 24 |  | - | 
| 25 |  | -**Note**: These instructions are meant for and only tested with GNU/Linux. OS X used to work,  | 
| 26 |  | -but there is an issue (#46) since the update to SCIP 4.0.0. | 
| 27 |  | - | 
| 28 |  | -Follow the steps below to get SCIP.jl working. Unfortunately, these steps can not be automated as part of `Pkg.build("SCIP")`, because the academic license of SCIP does not allow distribution of the source code without tracking the download metadata. See the [license](http://scip.zib.de/academic.txt) for details. | 
| 29 |  | - | 
| 30 |  | -1.The SCIP.jl package requires [SCIP](http://scip.zib.de/) to be installed in a recent version (e.g. 6.0.0). | 
| 31 |  | -[Download](http://scip.zib.de) the SCIP Optimization Suite. | 
| 32 |  | -``` | 
| 33 |  | -tar xzf scipoptsuite-6.0.0.tgz | 
| 34 |  | -``` | 
| 35 |  | - | 
| 36 |  | -2.Choose an installation path and set the **environment variable `SCIPOPTDIR`** to point there. | 
| 37 |  | -``` | 
| 38 |  | -export SCIPOPTDIR=`my/install/dir` | 
| 39 |  | -``` | 
| 40 |  | - | 
| 41 |  | -3.Build and install the shared library with | 
| 42 |  | -``` | 
| 43 |  | -mkdir build | 
| 44 |  | -cd build | 
| 45 |  | -cmake -DCMAKE_INSTALL_PREFIX=$SCIPOPTDIR .. | 
| 46 |  | -make | 
| 47 |  | -make install | 
| 48 |  | -``` | 
| 49 |  | - | 
| 50 |  | -4.This package is registered in `METADATA.jl` and can be installed in Julia with | 
| 51 |  | -``` | 
| 52 |  | -Pkg.add("SCIP") | 
| 53 |  | -``` | 
| 54 |  | - | 
| 55 |  | -## Setting Parameters | 
| 56 |  | - | 
| 57 |  | -SCIP has a [long list of parameters](http://scip.zib.de/doc/html/PARAMETERS.php) | 
| 58 |  | -that can all be set through SCIP.jl, by passing them to the constructor of | 
| 59 |  | -`SCIPSolver`. To set a value `val` to a parameter `name`, pass the two | 
| 60 |  | -parameters `(name, val)`. For example, let's set two parameters, to disable | 
| 61 |  | -output and increase the gap limit to 0.05: | 
| 62 |  | -``` | 
| 63 |  | -solver = SCIPSolver("display/verblevel", 0, "limits/gap", 0.05) | 
| 64 |  | -``` | 
|  | 9 | +## Update (December 2018) | 
|  | 10 | + | 
|  | 11 | +We have completely rewritten the interface from scratch, using | 
|  | 12 | +[Clang.jl](https://github.com/ihnorton/Clang.jl) to generate wrappers based on | 
|  | 13 | +the headers of the SCIP library. | 
|  | 14 | +The goal is to support [JuMP](https://github.com/JuliaOpt/JuMP.jl) (from version | 
|  | 15 | +0.19 on) through | 
|  | 16 | +[MathOptInterface](https://github.com/JuliaOpt/MathOptInterface.jl). | 
|  | 17 | + | 
|  | 18 | +Currently, we support LP and MIP problems only. | 
|  | 19 | +This means we still have a feature loss in the areas as nonlinear constraints as | 
|  | 20 | +well as supported callbacks compared to previous versions (see below). | 
|  | 21 | + | 
|  | 22 | +## Getting Started | 
|  | 23 | + | 
|  | 24 | +To use SCIP.jl, you will need [SCIP](http://scip.zib.de) installed on your | 
|  | 25 | +system. [SCIP's license](https://scip.zib.de/index.php#license) does not allow | 
|  | 26 | +(automatic) redistribution, so please | 
|  | 27 | +[download](https://scip.zib.de/index.php#download) and install it yourself. | 
|  | 28 | + | 
|  | 29 | +Only Linux is tested and officially supported. Contributions to supporting other | 
|  | 30 | +operating systems are welcome. | 
|  | 31 | + | 
|  | 32 | +We recommend using one of the provided installers, e.g., | 
|  | 33 | +`SCIPOptSuite-6.0.0-Linux.deb` for systems based on Debian. Adding the SCIP.jl | 
|  | 34 | +package should then work out of the box: | 
|  | 35 | + | 
|  | 36 | +    pkg> add SCIP | 
|  | 37 | + | 
|  | 38 | +If you [build SCIP from source](https://scip.zib.de/doc-6.0.0/html/CMAKE.php) | 
|  | 39 | +you should set the environment variable `SCIPOPTDIR` to point the the | 
|  | 40 | +**installation path**. That is, `$SCIPOPTDIR/lib/libscip.so` should exist. | 
|  | 41 | + | 
|  | 42 | +## Design Considerations | 
|  | 43 | + | 
|  | 44 | +**Wrapper of Public API**: All of SCIP's public API methods are wrapped and | 
|  | 45 | +available within the `SCIP` package. This includes the `scip_*.h` and `pub_*.h` | 
|  | 46 | +headers that are collected in `scip.h`, as well as all default constraint | 
|  | 47 | +handlers (`cons_*.h`.) But the wrapped functions do not transform any data | 
|  | 48 | +structures and work on the *raw* pointers (e.g. `SCIP*` in C, `Ptr{SCIP_}` in | 
|  | 49 | +Julia). Convenience wrapper functions based on Julia types are added as needed. | 
|  | 50 | + | 
|  | 51 | +**Memory Management**: Programming with SCIP requires dealing with variable and | 
|  | 52 | +constraints objects that use [reference | 
|  | 53 | +counting](https://scip.zib.de/doc-6.0.0/html/OBJ.php) for memory management. | 
|  | 54 | +SCIP.jl provides a wrapper type `ManagedSCIP` that collects lists of `SCIP_VAR*` | 
|  | 55 | +and `SCIP_CONS*` under the hood, and releases all reference when it is garbage | 
|  | 56 | +collected itself (via `finalize`). When adding a variable (`add_variable`) or a | 
|  | 57 | +constraint (`add_linear_constraint`), an integer index is returned. This index | 
|  | 58 | +can be used to retrieve the `SCIP_VAR*` or `SCIP_CONS*` pointer via `get_var` | 
|  | 59 | +and `get_cons` respectively. | 
|  | 60 | + | 
|  | 61 | +`ManagedSCIP` does not currently support deletion of variables or constraints. | 
|  | 62 | + | 
|  | 63 | +**Supported Features for MathOptInterface**: We aim at exposing many of SCIP's | 
|  | 64 | +features through MathOptInterface. However, the focus is on keeping the wrapper | 
|  | 65 | +simple and avoiding duplicate storage of model data. | 
|  | 66 | + | 
|  | 67 | +As a consequence, we do not currently support some features such as retrieving | 
|  | 68 | +constraints by name (`SingleVariable`-set constraints are not stored as SCIP | 
|  | 69 | +constraints explicitly). | 
|  | 70 | + | 
|  | 71 | +Support for more constraint types (quadratic/SOC, SOS1/2, nonlinear expression) | 
|  | 72 | +is planned, but SCIP itself only supports affine objective functions, so we will | 
|  | 73 | +stick with that. More general objective functions could be implented via a | 
|  | 74 | +[bridge](https://github.com/JuliaOpt/MathOptInterface.jl/issues/529). | 
|  | 75 | + | 
|  | 76 | +## Old Interface Implementation | 
|  | 77 | + | 
|  | 78 | +A previous implementation of SCIP.jl supported | 
|  | 79 | +[JuMP](https://github.com/JuliaOpt/JuMP.jl) (up to version 0.18) through | 
|  | 80 | +[MathProgBase](https://github.com/JuliaOpt/MathOptInterface.jl). It did not | 
|  | 81 | +interface SCIP directly, but went through | 
|  | 82 | +[CSIP](https://github.com/SCIP-Interfaces/CSIP), a simplified C wrapper. | 
|  | 83 | + | 
|  | 84 | +Back then, the interface support MINLP problems as well as solver-indepentent | 
|  | 85 | +callbacks for lazy constraints and heuristics. | 
|  | 86 | + | 
|  | 87 | +To use that version, you need to pin the version of SCIP.jl to `v0.6.1` (the | 
|  | 88 | +last release before the rewrite): | 
|  | 89 | + | 
|  | 90 | +    pkg> add SCIP@v0.6.1 | 
|  | 91 | +    pkg> pin SCIP | 
0 commit comments