Skip to content
omega-iclPublic

About

Library for construction, manipulation and evaluation of factorable functions

Resources

Stars

17 stars

Watchers

4 watching

Forks

Repository files navigation

MC++: Toolkit for Construction, Manipulation and Evaluation of Factorable Functions

MC++ provides a collection of classes to support the construction and manipulation of factorable functions and their evaluation using a range of arithmetics. It is primarily written in C++ to promote execution speed, while the library PyMC++ provides Python binders through pybind11 (the module is imported as pymcpp).

Expression trees in MC++ can comprise any finite combination of unary and binary operations from a default library and are described by directed acyclic graphs (DAGs). MC++ also features a mechanism to extend DAGs with external operations, currently including affine and polynomial subexpressions, multi-layer perceptrons (MLP) and nested DAGs. Through the library CRONOS, MC++ can also be extended with systems of algebraic and differential equations. Expression trees generated with MC++ are used by the library CANON for local and global numerical optimization, and by the library MAGNUS for the development and analysis of mathematical models.

Capabilities

Version 5 of MC++ supports:

  • Expression trees: construction of factorable functions as DAGs, with common-subexpression elimination; differentiation in both forward and reverse accumulation modes; evaluation in any of the arithmetics below; vectorized and multi-threaded evaluation over many points.
  • Decomposition: recursive decomposition of factorable expressions into linear/polynomial subexpressions and transcendental operations, the basis for tailored relaxation and reformulation strategies.
  • Nested expression trees: a DAG as an operation of another DAG, to enable tailored bounding strategies.
  • External operations: user-defined operations with their own evaluation and differentiation rules -- the mechanism CRONOS uses to embed differential-equation solvers.

The bounding arithmetics, each a header that can be used on its own or through the DAGs:

arithmetic purpose
Interval arithmetic rigorous enclosures (Boost, PROFIL/BIAS or FILIB++ as backend)
Eigenvalue arithmetic spectral bounds of Hessians
Ellipsoidal arithmetic ellipsoidal enclosures of multivariate systems
McCormick relaxations convex/concave relaxations and their subgradients
Taylor and Chebyshev models polynomial models with rigorous remainder bounds
Polyhedral relaxations linear relaxations for use in LP/MILP solvers
Superposition relaxations relaxation via separable estimators

A range of Python scripts and notebooks in notebook/ illustrate these capabilities.

Setting up MC++

PyMC++ installs from PyPI, with pre-built wheels for Python 3.10 to 3.14 on Linux, macOS and Windows:

pip install pymcpp

To use the C++ headers, a different interval backend, or the HSL and Torch options, build from source with CMake; refer to INSTALL.md for the requirements, options and instructions.

Layout

src/mc/              the MC++ headers (header-only library)
src/3rdparty/        bundled third-party headers (FADBAD++, used only with MC__USE_FADBAD)
src/pymcpp/          the Python binders (PyMC++, module `pymcpp`)
test/                C++ test and example programs
notebook/            Python scripts and Jupyter notebooks

Contacts

References

Methods implemented in MC++:

Software building on MC++:

License

MC++ is published under the Eclipse Public License. The bundled FADBAD++ (MC__USE_FADBAD, off by default) is a separate work distributed for non-commercial use only: commercial use requires a license from its authors.

About

Library for construction, manipulation and evaluation of factorable functions

Resources

Stars

17 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages