Skip to content

A Python toolkit for Machine Learning (ML) practices for Combinatorial Optimization (CO).

License

Notifications You must be signed in to change notification settings

Thinklab-SJTU/ML4CO-Kit

Repository files navigation

PyPi version PyPI pyversions Downloads Documentation Status codecov GitHub stars

Combinatorial Optimization (CO) is a mathematical optimization area that involves finding the best solution from a large set of discrete possibilities, often under constraints. Widely applied in routing, logistics, hardware design, and biology, CO addresses NP-hard problems critical to computer science and industrial engineering.

ML4CO-Kit aims to provide foundational support for machine learning practices on CO problems, including the follow aspects.

  • algorithm: common post-processing algorithms.
  • data: common test datasets and our generated traning dataset.
  • draw: visualization of problems and solutions.
  • evaluate: evaluator for problems and solvers.
  • generator: data generation of various distributions.
  • learning: implemented base classes that facilitate method development for ML4CO.
  • solver: solvers' base classes and mainstream traditional solvers.
  • utils: general or commonly used functions and classes.

Official Documentation: https://ml4co-kit.readthedocs.io/en/latest/

Source Code: https://github.com/Thinklab-SJTU/ML4CO-Kit

Development status

Basic

Problem Generator Basic Solver (IO) Traditional Solver
ATSP sat, hcp, uniform tsplib, txt LKH
CVRP uniform, gaussian vrplib, txt LKH, HGS, PyVRP
MCl er, ba, hk, ws gpickle, txt, networkx Gurobi
MCut er, ba, hk, ws gpickle, txt, networkx Gurobi
MIS er, ba, hk, ws gpickle, txt, networkx Gurobi, KaMIS
MVC er, ba, hk, ws gpickle, txt, networkx Gurobi
TSP uniform, gaussian, cluster tsplib, txt LKH, Concorde, GAX

Extension

Problem Visualization Algorithm Test Dataset Train Dataset
ATSP 📆 2 📆 📆
CVRP 📆 vrplib, uniform 📆
MCl 📆 📆 📆
MCut 📆 📆 📆
MIS 📆 📆 📆
MVC 📆 📆 📆
TSP 4 satlib, uniform uniform

1~9: Number of supports; ✔: Supported; 📆: Planned for future versions (contributions welcomed!).

We are still enriching the library and we welcome any contributions/ideas/suggestions from the community.

A comprehensive modular framework built upon this library that integrates core ML4CO technologies is coming soon.

Installation

You can install the stable release on PyPI:

$ pip install ml4co-kit

or get the latest version by running:

$ pip install -U https://github.com/Thinklab-SJTU/ML4CO-Kit/archive/master.zip # with --user for user install (no root)

The following packages are required and shall be automatically installed by pip:

Python>=3.8
numpy>=1.24.4
networkx>=2.8.8
tqdm>=4.66.3
pulp>=2.8.0, 
pandas>=2.0.0,
scipy>=1.10.1
aiohttp>=3.10.11
requests>=2.32.0
async_timeout>=4.0.3
pyvrp>=0.6.3
cython>=3.0.8
gurobipy>=11.0.3

To ensure you have access to all functions, such as visualization, you'll need to install the following packages using pip:

matplotlib
pytorch_lightning

About

A Python toolkit for Machine Learning (ML) practices for Combinatorial Optimization (CO).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •