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
data
Problem | First | Impl. | Second | Impl. | Third | Impl. |
---|---|---|---|---|---|---|
TSP | tsplib | ✔ | LKH | ✔ | Concorde | ✔ |
MIS | satlib | ✔ | KaMIS | 📆 | -- | -- |
evaluator
Problem | First | Impl. | Second | Impl. |
---|---|---|---|---|
TSP | tsplib | 📆 | uniform | 📆 |
MIS | satlib | 📆 | ER | 📆 |
generator
Problem | Type1 | Impl. | Type2 | Impl. | Type3 | Impl. | Type4 | Impl. |
---|---|---|---|---|---|---|---|---|
TSP | uniform | ✔ | gaussian | ✔ | cluster | 📆 | -- | -- |
MIS | ER | ✔ | BA | ✔ | HK | ✔ | WS | ✔ |
solver
Problem | Base | Impl. | First | Impl. | Second | Impl. |
---|---|---|---|---|---|---|
TSP | TSPSolver | ✔ | LKH | ✔ | Concorde | ✔ |
MIS | MISSolver | ✔ | KaMIS | ✔ | Gurobi | ✔ |
✔: 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.0.0,
scipy>=1.10.1
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.1a12.tar.gz
(3.2 MB
view hashes)
Built Distributions
Close
Hashes for data4co-0.0.1a12-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e552c29c70cdded51ba556088d7d1fa0e709df3ac2d2fc8a05941e18f65770c6 |
|
MD5 | b35efe8df0124fe47de42d0e6190d4f8 |
|
BLAKE2b-256 | 76886ba02775d4d9f9549fda50278a25cb4f4a4714d81ff21314e286b97a61ab |
Close
Hashes for data4co-0.0.1a12-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 758ecf2beaa9ca62ffab67e4e2ae318f8890bf4ee5bd2f105c77ede3229846d4 |
|
MD5 | f9542ba369e947e8ea1d7edd0e2e57ed |
|
BLAKE2b-256 | 5b5ffa65461f45a3d140408601dd080432a61937bdbbbf6fdbb4f4583f84d1c3 |
Close
Hashes for data4co-0.0.1a12-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ce1648dd6adf9a033fbd35ffc232a176e438b10d4bb8d879d8f74723ab4ae38 |
|
MD5 | b97dacba73df273d4eea855ea6cc0887 |
|
BLAKE2b-256 | 05ac56fd6adf28b519127cba367eabf678a8e11ccc75c923a930c7dbac3d64e2 |