MIP modelling and solving in C++.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Martin Beckmann d3059d3484
Overhaul CI and dependencies (#9)
4 months ago
.github/workflows Overhaul CI and dependencies (#9) 4 months ago
cmake Adds constraint scaling. 2 years ago
docker Overhaul CI and dependencies (#9) 4 months ago
miplib Overhaul CI and dependencies (#9) 4 months ago
test Fixing tests. 1 year ago
.gitignore Adds Readme. 3 years ago
CMakeLists.txt Adds constraint scaling. 2 years ago
LICENSE Initial commit 3 years ago
README.md Overhaul CI and dependencies (#9) 4 months ago
configure.sh Adds test workflow. 3 years ago

README.md

This repo provides a common C++ interface on top of popular MIP solvers (backends).

Currently it supports:

The library requires at least one of these backends to be installed.

Features

  • Binary, Integer, and Continuous variables (to do: SOS).
  • Linear constraints and objectives.
  • Quadratic constraints and objectives when supported by backend.
  • Indicator constraints with automatic reformulation if not supported by backend.

Example

using namespace miplib;

Solver solver(Solver::Backend::Scip);
solver.set_verbose(true);

Var v1(solver, Var::Type::Binary, "v1");
Var v2(solver, Var::Type::Binary, "v2");
Var v3(solver, Var::Type::Continuous, "v3");

solver.add(v1 == 1);
solver.add(v2 <= v1 - 1);
solver.add(v3 == v1 + v2);

auto r = solver.solve();

assert(r == Solver::Result::Optimal);

std::cout << v1.value() << std::endl; // prints 1
std::cout << v2.value() << std::endl; // prints 0
std::cout << v3.value() << std::endl; // prints 1

Building

Configure build (only required to do once)

[GUROBI=path-to-gurobi SCIP=path-to-scip] ./configure.sh

where GUROBI and SCIP vars might be required in case they are installed in non-standard locations.

NOTE: Both paths point to path containing the include and libdirs. For example path-to-gurobi should be something like /opt/gurobi903/linux64/.

Either

cmake --build build/{release|debug}

or

cd build/{release|debug}
make

Run tests

./build/{release|debug}/test/unit_test