Skip to content

Commit

Permalink
Merge pull request #1 from Thinklab-SJTU/pwz
Browse files Browse the repository at this point in the history
Support MC, MCl, MVC & Enhanced code reusability
  • Loading branch information
heatingma authored Oct 29, 2024
2 parents 0e357b6 + 119d04a commit 9564b81
Show file tree
Hide file tree
Showing 58 changed files with 4,791 additions and 32,534 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ tests/data_for_tests/draw/mis/mis_draw_example/solution/**
tests/data_for_tests/draw/mis/mis_draw_example_solution.png
tests/data_for_tests/draw/mis/mis_draw_example_problem.png
tests/data_for_tests/draw/cvrp/cvrp_draw_example_problem.png
tests/data_for_tests/draw/cvrp/cvrp_draw_example_solution.png
tests/data_for_tests/draw/cvrp/cvrp_draw_example_solution.png

# special
ml4co_kit/algorithm/tsp/decoder/cython_tsp_greedy/source/cython_tsp_greedy.c
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ This repository focuses on the supporting code for method development instead of

| Problem | Data | solver | Supervision | evaluator | visualization |
| :-----: | :--------------------------------: | :-----------: | :-------------------: | :-------: | :---------------------: |
| TSP | Uniform, Gaussian, Cluster, TSPLIB | LKH, Concorde, Concorde-Large, GA-EAX, GA-EAX-Large | Solution, Edge Regret || Problem Graph, Solution |
| MIS | SATLIB, ER, BA, HK, WS | KaMIS, Gurobi | Solution || Problem Graph, Solution |
| CVRP | Uniform, Gaussian, VRPLIB | PyVRP, LKH, HGS | Solution || Problem Graph, Solution |
| ATSP | SAT, HCP | LKH | Solution || -- |

| CVRP | Uniform, Gaussian, VRPLIB | PyVRP, LKH, HGS | Solution || Problem Graph, Solution |
| MC | SATLIB, ER, BA, HK, WS | Gurobi | Solution || Problem Graph, Solution |
| MCl | SATLIB, ER, BA, HK, WS | Gurobi | Solution || Problem Graph, Solution |
| MIS | SATLIB, ER, BA, HK, WS | KaMIS, Gurobi | Solution || Problem Graph, Solution |
| MVC | SATLIB, ER, BA, HK, WS | Gurobi | Solution || Problem Graph, Solution |
| TSP | Uniform, Gaussian, Cluster, TSPLIB | LKH, Concorde, Concorde-Large, GA-EAX, GA-EAX-Large | Solution, Edge Regret || Problem Graph, Solution |
###### ML4CO Organization:

<img src="docs/assets/organization.jpg" alt="Organization" width="800"/>
Expand Down Expand Up @@ -55,6 +57,7 @@ requests>=2.31.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`:
Expand Down
1 change: 0 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ coverage:
informational: true

ignore:
- ml4co_kit/solver/mis/gurobi.py
- ml4co_kit/solver/tsp/pyconcorde/setup.py
- ml4co_kit/learning/**
- ml4co_kit/solver/tsp/concorde_large.py
74 changes: 58 additions & 16 deletions ml4co_kit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,70 @@
import importlib.util

# base
from .algorithm import tsp_greedy_decoder, tsp_insertion_decoder, tsp_mcts_decoder
from .algorithm import tsp_mcts_local_search
from .algorithm import atsp_greedy_decoder
from .algorithm import atsp_2opt_local_search
from .data import TSPLIBOriDataset, TSPUniformDataset, TSPLIB4MLDataset, ML4TSPDataset
from .data import SATLIBOriDataset
#######################################################
# Support #
#######################################################
from .utils.type_utils import TASK_TYPE, SOLVER_TYPE, TASK_SUPPORT_SOLVER

#######################################################
# Algorithm #
#######################################################
from .algorithm import atsp_greedy_decoder, atsp_2opt_local_search
from .algorithm import (
tsp_greedy_decoder, tsp_insertion_decoder, tsp_mcts_decoder, tsp_mcts_local_search
)

#######################################################
# Free Dataset #
#######################################################
from .data import VRPLIBOriDataset, CVRPUniformDataset
from .evaluate import TSPEvaluator, TSPLIBOriEvaluator, TSPLIB4MLEvaluator, TSPUniformEvaluator
from .evaluate import SATLIBEvaluator
from .evaluate import CVRPEvaluator, CVRPUniformEvaluator
from .data import SATLIBOriDataset
from .data import TSPLIBOriDataset, TSPUniformDataset, TSPLIB4MLDataset, ML4TSPDataset

#######################################################
# Evaluator #
#######################################################
from .evaluate import ATSPEvaluator
from .generator import TSPDataGenerator, MISDataGenerator, CVRPDataGenerator, ATSPDataGenerator
from .solver import TSPSolver, TSPLKHSolver, TSPConcordeSolver, TSPConcordeLargeSolver
from .solver import TSPGAEAXSolver, TSPGAEAXLargeSolver
from .solver import MISSolver, KaMISSolver, MISGurobiSolver
from .solver import CVRPSolver, CVRPPyVRPSolver, CVRPLKHSolver, CVRPHGSSolver
from .evaluate import CVRPEvaluator, CVRPUniformEvaluator
from .evaluate import SATLIBEvaluator
from .evaluate import TSPEvaluator, TSPLIBOriEvaluator, TSPLIB4MLEvaluator, TSPUniformEvaluator

#######################################################
# Data Generator #
#######################################################
from .generator import ATSPDataGenerator
from .generator import CVRPDataGenerator
from .generator import MCDataGenerator
from .generator import MClDataGenerator
from .generator import MISDataGenerator
from .generator import MVCDataGenerator
from .generator import TSPDataGenerator

#######################################################
# Solver #
#######################################################
from .solver import ATSPSolver, ATSPLKHSolver
from .solver import CVRPSolver, CVRPPyVRPSolver, CVRPLKHSolver, CVRPHGSSolver
from .solver import MCSolver, MCGurobiSolver
from .solver import MClSolver, MClGurobiSolver
from .solver import MISSolver, KaMISSolver, MISGurobiSolver
from .solver import MVCSolver, MVCGurobiSolver
from .solver import (
TSPSolver, TSPLKHSolver, TSPConcordeSolver,
TSPConcordeLargeSolver, TSPGAEAXSolver, TSPGAEAXLargeSolver
)

#######################################################
# Utils Function #
#######################################################
from .utils import download, compress_folder, extract_archive, _get_md5
from .utils import iterative_execution_for_file, iterative_execution
from .utils import np_dense_to_sparse, np_sparse_to_dense, GraphData, tsplib95
from .utils import MISGraphData, sat_to_mis_graph, cnf_folder_to_gpickle_folder, cnf_to_gpickle
from .utils import MISGraphData, MVCGraphData, MClGraphData, MCGraphData
from .utils import sat_to_mis_graph, cnf_folder_to_gpickle_folder, cnf_to_gpickle

#######################################################
# Extension Function #
#######################################################
# expand - matplotlib
found_matplotlib = importlib.util.find_spec("matplotlib")
if found_matplotlib is not None:
Expand Down
Loading

0 comments on commit 9564b81

Please sign in to comment.