Go bindings for SCIP, one of the fastest non-commercial solvers for mixed integer programming (MIP) and mixed integer nonlinear programming (MINLP). scipgo is a port of the Rust crate russcip and follows its API closely, so the two are easy to move between.
model := scip.DefaultModel().HideOutput().Maximize()
x := scip.NewVar().Name("x").Int().Obj(3).AddTo(model)
y := scip.NewVar().Name("y").Int().Obj(4).AddTo(model)
model.Add(
scip.NewCons().Coef(x, 2).Coef(y, 1).Le(100),
scip.NewCons().Coef(x, 1).Coef(y, 2).Le(80),
)
solved := model.Solve()
sol, _ := solved.BestSol()
fmt.Println(solved.Status(), sol.ObjVal(), sol.Val(x), sol.Val(y))
// Optimal 200 40 20- The whole modeling surface. Continuous, integer, binary and implicit integer variables; linear, set partitioning, packing and covering, cardinality, SOS1, indicator, quadratic and general nonlinear constraints; expression trees and SCIP's own expression syntax; reading and writing LP, MPS and the other formats SCIP knows.
- Plugins in Go. Branching rules, primal heuristics, separators,
pricers, constraint handlers, event handlers and node selectors are Go
interfaces, registered with a builder. Panics in callbacks are captured
and re-raised from
Solveinstead of crashing the process. - Safe by construction. Methods that can fail against SCIP come in a panicking and an error-returning form, so you choose per call site. Every query checks the solver stage and the liveness of the model and handle before touching SCIP, so a call in the wrong stage, on a freed model, or with a handle from a freed or replaced problem produces a Go error instead of undefined behaviour.
- Fits a Go service. Solves stop on a
context.Context. SCIP's log routes into anio.Writer, a*slog.Loggeror a callback. Memory is released explicitly withFreeor by a finalizer. - Concurrent and exact solving. SCIP's parallel portfolio through
SolveConcurrent, and end-to-end rational arithmetic throughEnableExactSolvingwith*big.Ratresults.
scipgo links against an installed SCIP 10 through cgo. Nothing is bundled.
# macOS
brew install scip
# Ubuntu 22.04 (packages for other distributions on the SCIP releases page)
wget https://github.com/scipopt/scip/releases/download/v10.0.2/scipoptsuite_10.0.2-1+jammy_amd64.deb
sudo apt-get install -y ./scipoptsuite_10.0.2-1+jammy_amd64.deb
go get github.com/egoisutolabs/scipgo/scipGo 1.25 or newer and a C compiler are required. SCIP in a custom location, Docker images and build errors are covered in the installation guide.
The documentation walks through the binding from the first model to branch-and-price; the API reference documents every method.
| Guide | Covers |
|---|---|
| Getting started | A first model, builders, reading a file, controlling the solve |
| Modeling | Variables, every constraint kind, nonlinear expressions, file I/O |
| Solving | Statuses, limits, stopping a solve, statistics, re-solving, concurrent and exact modes |
| Solutions | Reading solutions, MIP starts, partial solutions |
| Parameters | The parameter API and the parameters worth knowing |
| Logging | Routing SCIP's log and error output |
| Errors | Try and panicking forms, error types, liveness |
| Model lifecycle | Stages, handles, memory, goroutines |
| Plugins | Writing branch rules, heuristics, separators, pricers, constraint handlers, event handlers and node selectors |
| Coming from russcip | The mapping between the Rust API and this one |
Eleven complete programs live under examples/,
each solving a real problem and checking its answer: a first MIP, a
knapsack, custom branching, node selection, event handling, a rounding
heuristic, a clique separator, TSP with subtour elimination, cutting stock
and bin packing by branch-and-price, and a concurrent solve. Run one from
its directory with go run ..
| Path | Contents |
|---|---|
scip/ |
The library, a single Go package. cgo glue, the Model API, builders and plugin callbacks live together because cgo's exported trampolines must sit in the package that owns the C helpers |
examples/ |
Example programs |
docs/ |
The guides |
data/test/ |
Small LP and MPS instances used by the tests and examples |
scipgo is pre-1.0. The API is stable in shape, and renames ship with deprecated aliases that stay until the next major version; see the changelog. It is tested on macOS and Linux against SCIP 10 on every push.
Bug reports, questions and pull requests are welcome. The contributing guide covers the development setup, the test suite and the conventions the code follows.
scipgo is licensed under the MIT License, Copyright (c) 2026 Egoisuto Labs.
It is a port of russcip by Mohammed
Ghannam and contributors, licensed under the Apache License 2.0. The
derived parts (API design, tests, examples, data/test) keep that
license; see LICENSE-russcip and NOTICE,
and keep both files with any redistribution. SCIP
itself is Apache-2.0 and is linked, not bundled.