GithubHelp home page GithubHelp logo

gerhobbelt / monolith Goto Github PK

View Code? Open in Web Editor NEW

This project forked from petters/monolith

0.0 0.0 0.0 63.56 MB

A C++ monorepo for discrete and continuous optimization. Batteries included!

License: GNU General Public License v3.0

Shell 0.01% JavaScript 0.03% C++ 23.06% Python 0.83% C 0.05% HTML 0.03% CMake 0.29% AMPL 28.51% Jupyter Notebook 38.11% BASIC 0.13% JetBrains MPS 8.95%

monolith's Introduction

Monolith

Monolith is a monorepo with several optimization projects. Some of the code was originally written for research or as hobby projects in other repositories (e.g. spii and easy-IP).

One of the highlights is a state-of-the-art scheduler using column generation, which significantly outperforms all other optimizers at schedulingbenchmarks.org. Try it in the browser (wasm) here!

Why a monorepo?

  • C++ does not have an ABI. Every compiler, or worse, every flag configuration of every compiler generates potentially incompatible code. I want to use many compilers (MCVC, GCC, Clang) and many settings (debug, release, asan, fuzzers etc.). I also use Emscripten to compile programs to WASM (example here).
  • Refactoring code becomes much easier if all code with all dependencies is available in one IDE at the same time.

Contact

Petter Strandmark, [email protected]

Modules

Column generation

Implements the algorithm described in First-order Linear Programming in a Column Generation-Based Heuristic Approach to the Nurse Rostering Problem (2020) doi link.

The minimum::linear::colgen module contains code for solving scheduling problems. It significantly outperforms all other optimizers at schedulingbenchmarks.org.

Some of the reasons it is fast:

  • It uses a first-order LP solver based on papers by Chambolle and Pock.
  • The Ryan-Foster rule is used to iteratively work towards an integer solution. There is no time to branch and bound for big problems.
  • The pricing problem uses highly optimized dynamic programming in a DAG (in minimum::algorithms).

See the README in the module itself for more info.

Minimum/AI

The minimum::ai module contains code originally from my Monte-Carlo tree search repository. It is very fast – some years ago it evaluated almost 2 million complete games per second when playing 4 in a row.

Minimum/Linear

The minimum::linear module contains code originally from my easy-IP repository. It is a modelling interface (DSL) for integer programming and supports converting IPs to SAT. It also uses two free solvers: Cbc and Glpk.

minimum::linear also contains an implementation of a first-order LP solver based on papers by Chambolle and Pock. Using a first-order LP solver is very important when solving really big scheduling problems.

Minimum/Nonlinear

The minimum::nonlinear module contains code originally from my spii repository. When a function is defined, it will be automatically differentiated with an autodiff library. This makes the resulting code very fast and numerically stable. The library contains minimization routines like L-BFGS and Newton’s method.

For example, a function of one vector variable is simply defined as:

auto lambda = [](auto* x) {
    auto d0 = x[1] - x[0] * x[0];
    auto d1 = 1 - x[0];
    return 100 * d0 * d0 + d1 * d1;
};

Having auto here instead of e.g. double is crucial. Efficient code for first and second-order derivatives is generated with

auto term = make_differentiable<2>(lambda);

Minimum/Constrained

Using both minimum::linear and minimum::nonlinear, this module implements constrained optimization via successive linear programming.

Minimum/Curvature

The module minimum::curvature contains code originally written at curve_extraction. It computes shortest paths in regular graphs taking curvature into account.

Building

Everything needed to build the library is included. With CMake and a modern C++ compiler, you can do

$ cmake /path/to/source
$ make

Licence

The license can be found in the LICENSE file. Contact me if you need another license.

The software in the third-party folder is not written exclusively by me and their respective license files apply.

monolith's People

Contributors

dependabot[bot] avatar gerhobbelt avatar jthemphill avatar petters avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.