Skip to main content

Flowty Network Optimization Solver

Project description

Flowty

Flowty is a network optimization solver for multi-commodity flow (MCF), resource-constrained MCF (RCMCF), fixed-charge MCF (FCMCF), vehicle routing (VRPTW), and related problems. It uses column generation with branch-and-bound, where subproblems are resource-constrained shortest path problems solved over user-defined graphs. Written in C++ with a Python interface.

Installation

System dependencies (Ubuntu/Debian):

sudo apt-get install libopenblas0 libtbb12

Then install the package:

pip install flowty

Quick Start

Multi-Commodity Flow

Use McfModel for MCF problems:

import flowty

model = flowty.McfModel(flowty.McfModel.Type.Path)

# Network with 4 edges: sources, targets, costs, capacities
model.addEdges([0, 1, 0, 2], [1, 3, 2, 3], [1.0, 1.0, 1.0, 2.0], [10.0, 10.0, 10.0, 10.0])

# Two commodities: origins, destinations, demands
model.addCommodities([0, 0], [1, 3], [3.0, 2.0])

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

Vehicle Routing with Time Windows

Use Model for VRPTW and other resource-constrained problems:

import flowty

model = flowty.Model()

# Graph: depot(0) -> customer(1) -> depot(2)
edges = [(0, 1), (1, 2)]
costs = [1.0, 1.0]

# Resources: time windows and capacity
resources = [
    ({"V": [[0, 0, 0], [10, 10, 10]], "E": [[1, 1]]}, "time"),
    ({"V": [[0, 1, 0]], "G": [2]}, "capacity"),
]

graph = model.addGraph(edges, costs, [], resources, flowty.Graph.PathSense.Simple)
rules = [("Window", ["time"]), ("Capacity", ["capacity"])]
model.addSubproblem(graph, 0, 2, 0.0, 1.0, 1.0, "B", rules)

# Each customer must be visited at least once
model += graph.vertices[1] >= 1.0

status = model.solve()
solution = model.getSolution()
print(f"Status: {status}, Cost: {solution.cost}")

Documentation

Full documentation at docs.flowty.ai.

License

The solver ships with a Non-Commercial License. For commercial licenses, contact license@flowty.ai.

Issues & Contact

Report issues at github.com/flowty/flowty.

For inquiries contact info@flowty.ai.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flowty-2.2.2-cp312-abi3-manylinux_2_39_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.39+ x86-64

File details

Details for the file flowty-2.2.2-cp312-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for flowty-2.2.2-cp312-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 06150dd5db9f3758c99834de622b50ab75d18975222679706f558e8b5e9b6564
MD5 d9b118941ceca0d4b7872b2b26ed8be3
BLAKE2b-256 5062a4a5264b534385736aade67a1bb74a64b950e4aead7b12e4bc75153be8e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowty-2.2.2-cp312-abi3-manylinux_2_39_x86_64.whl:

Publisher: release.yml on flowty/flowty-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page