Skip to content

Flowty

A column-generation based network optimization solver for multi-commodity flow and resource-constrained path problems. Written in C++ with a Python interface.

Install

Requires Linux x86_64 (Ubuntu 24.04+) and Python 3.12+. See PyPI.

sudo apt-get install libopenblas0 libtbb12
pip install flowty

Quick Start

import flowty


def mcf():
    model = flowty.McfModel()

    # edges: (source, target, cost, capacity)
    edges = [(0, 1, 2, 10), (0, 2, 3, 10), (1, 3, 1, 5), (2, 3, 1, 5)]
    for s, t, c, u in edges:
        model.addEdge(s, t, c, u)

    # commodities: (origin, destination, demand)
    commodities = [(0, 3, 3.0), (2, 3, 2.0)]
    for o, d, b in commodities:
        model.addCommodity(o, d, b)

    status = model.solve()
    solution = model.getSolution()
    if solution:
        print(f"Cost: {solution.cost}")
        print(f"Edge flows: {solution.edgeFlows}")


if __name__ == "__main__":
    mcf()

API

Flowty provides three model classes:

  • McfModel -- High-level API for multi-commodity flow problems. Start here.
  • Model -- General-purpose model with graphs, subproblems, variables, and constraints. Use for FCMCF, VRPTW, and custom formulations.
  • PathModel -- Lightweight path-only model.

See also: Resources & Rules | Parameters

Examples

License

The solver ships with a Non-Commercial License. For commercial or academic licenses write to license@flowty.ai.

Support