Skip to content
/ miplib Public
forked from gnosis/miplib

MIP modelling and solving in C++.

License

Notifications You must be signed in to change notification settings

marcovc/miplib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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::BackendRequest::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/.

Compile/Link

Either

cmake --build build/{release|debug}

or

cd build/{release|debug}
make

Run tests

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

Deploy

See:

docker/deploy.sh

About

MIP modelling and solving in C++.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 80.8%
  • CMake 17.1%
  • Dockerfile 1.9%
  • Shell 0.2%