data4co provides convenient dataset generators for the combinatorial optimization problem
Project description
Data4CO
A data generator tool for Combinatorial Optimization (CO) problems, enabling customizable, diverse, and scalable datasets for benchmarking optimization algorithms.
Current support
solver
Problem | Base | Impl. | First | Impl. | Second | Impl. | Third | Impl. | Fourth | Impl. |
---|---|---|---|---|---|---|---|---|---|---|
TSP | TSPSolver | ✔ | LKH | ✔ | Concorde | ✔ | NAR | 📆 | AR | 📆 |
MIS | MISSolver | ✔ | KaMIS | ✔ | Gurobi | ✔ | -- | -- | -- | -- |
generator
Problem | Type1 | Impl. | Type2 | Impl. | Type3 | Impl. | Type4 | Impl. |
---|---|---|---|---|---|---|---|---|
TSP | uniform | ✔ | gaussian | ✔ | cluster | 📆 | -- | -- |
MIS | ER | ✔ | BA | ✔ | HK | ✔ | WS | ✔ |
✔: Supported; 📆: Planned for future versions (contributions welcomed!).
How to Install
Github
Clone with the url https://github.com/heatingma/Data4CO.git , and the following packages are required, and shall be automatically installed by pip
:
Python >= 3.8
numpy>=1.24.4
networkx==2.8.8
lkh>=1.1.1
tsplib95==0.7.1
tqdm>=4.66.1
pulp>=2.8.0,
pandas>=2.2.0,
scipy>=1.12.0
PyPI It is very convenient to directly use the following commands
pip install data4co
How to Use Solver (TSPLKHSolver as example)
from data4co.solver import TSPLKHSolver
tsp_lkh_solver = TSPLKHSolver(lkh_max_trials=500)
tsp_lkh_solver.from_txt("path/to/read/file.txt")
tsp_lkh_solver.solve()
tsp_lkh_solver.evaluate()
tsp_lkh_solver.to_txt("path/to/write/file.txt")
How to Use Generator (TSPDataGenerator as example)
from data4co import TSPDataGenerator
tsp_data_lkh = TSPDataGenerator(
num_threads=8,
nodes_num=50,
data_type="uniform",
solver="lkh",
train_samples_num=16,
val_samples_num=16,
test_samples_num=16,
save_path="path/to/save/"
)
tsp_data_lkh.generate()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
data4co-0.0.1a8.tar.gz
(3.2 MB
view hashes)
Built Distributions
Close
Hashes for data4co-0.0.1a8-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7fd507d0ca8de2cc60f518c59a2ff12f0c292f36bb2c5340037978959f8f654 |
|
MD5 | 071efd0d6680fbedb0620c92e9004971 |
|
BLAKE2b-256 | 47886cbdd2e319958024efaec2aa48cf0d823c9e80f39fa69959c5b6a8845dcb |
Close
Hashes for data4co-0.0.1a8-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9b1f257c453943e2dc44d3c883acd9fdff25195fd313521f4ab972d087bf44d |
|
MD5 | 37dc08a09867ecd093c667cc2941872b |
|
BLAKE2b-256 | 9c18d7319418f0fb9dac91ef5fd7390790e0b902c852e6f5bb8b5d3e6fff1ad3 |
Close
Hashes for data4co-0.0.1a8-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 716d7ddd091738c437873cd5952f9196c028aaada5e1082e5069a53614f0ed15 |
|
MD5 | d5ec848aa86a1961571f35c8b90fdab8 |
|
BLAKE2b-256 | 2b1a6ddf5235dc086d1676fffc7dc256d01e8190b4d299e6bb6d2cc5f98beaeb |