Skip to content
Tech News
← Back to articles

Show HN: Go Bindings for SCIP Optimizer

read original more articles
Why This Matters

This project brings Go language bindings to SCIP, a leading solver for mixed integer and nonlinear programming problems, making it easier for Go developers to build optimization tools without switching to Rust, C, or Python. It matters because optimization solvers are widely used in logistics, scheduling, and operations research, and expanding language support broadens accessibility for developers building production systems in Go.

Key Takeaways

scipgo

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

Features

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.

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 Solve instead of crashing the process.

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 instead 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.

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 an io.Writer , a *slog.Logger or a callback. Memory is released explicitly with Free or by a finalizer.

Solves stop on a . SCIP's log routes into an , a or a callback. Memory is released explicitly with or by a finalizer. Concurrent and exact solving. SCIP's parallel portfolio through SolveConcurrent , and end-to-end rational arithmetic through EnableExactSolving with *big.Rat results.

Installation

... continue reading