diff --git a/ml4co_kit/__init__.py b/ml4co_kit/__init__.py index ad821d4..a5782a9 100644 --- a/ml4co_kit/__init__.py +++ b/ml4co_kit/__init__.py @@ -57,15 +57,14 @@ # Utils Function # ####################################################### from .utils import download, compress_folder, extract_archive, _get_md5 -from .utils import iterative_execution_for_file, iterative_execution +from .utils import iterative_execution_for_file, iterative_execution, Timer from .utils import np_dense_to_sparse, np_sparse_to_dense, GraphData, tsplib95 from .utils import MISGraphData, MVCGraphData, MClGraphData, MCutGraphData from .utils import sat_to_mis_graph, cnf_folder_to_gpickle_folder, cnf_to_gpickle ####################################################### -# Extension Function # +# Extension Function (matplotlib) # ####################################################### -# expand - matplotlib found_matplotlib = importlib.util.find_spec("matplotlib") if found_matplotlib is not None: from .draw.cvrp import draw_cvrp_problem, draw_cvrp_solution @@ -75,7 +74,9 @@ from .draw.mvc import draw_mvc_problem, draw_mvc_solution from .draw.tsp import draw_tsp_problem, draw_tsp_solution -# expand - pytorch_lightning +####################################################### +# Extension Function (pytorch_lightning) # +####################################################### found_pytorch_lightning = importlib.util.find_spec("pytorch_lightning") if found_pytorch_lightning is not None: from .learning.env import BaseEnv diff --git a/ml4co_kit/generator/mcut_data.py b/ml4co_kit/generator/mcut_data.py index f5e9d5e..922e3ba 100644 --- a/ml4co_kit/generator/mcut_data.py +++ b/ml4co_kit/generator/mcut_data.py @@ -6,7 +6,7 @@ import numpy as np import networkx as nx from tqdm import tqdm -from typing import Union +from typing import Union, List from ml4co_kit.utils.graph.mcut import MCutGraphData from ml4co_kit.utils.type_utils import SOLVER_TYPE from ml4co_kit.solver import MCutSolver, MCutGurobiSolver @@ -15,6 +15,7 @@ class MCutDataGenerator: def __init__( self, + only_instance_for_us: bool = False, num_threads: int = 1, nodes_num_min: int = 700, nodes_num_max: int = 800, @@ -92,13 +93,18 @@ def __init__( self.ws_prob = ws_prob self.ws_ring_neighbors = ws_ring_neighbors - # check the input variables - self.sample_types = ["train", "val", "test"] - self.check_num_threads() + # only instance for us + self.only_instance_for_us = only_instance_for_us self.check_data_type() - self.check_solver() - self.check_save_path() - self.get_filename() + + # generate and solve + if only_instance_for_us == False: + # check the input variables + self.sample_types = ["train", "val", "test"] + self.check_num_threads() + self.check_solver() + self.check_save_path() + self.get_filename() def check_num_threads(self): self.samples_num = 0 @@ -195,6 +201,11 @@ def check_free(self): def random_weight(self, n, mu=1, sigma=0.1): return np.around(np.random.normal(mu, sigma, n)).astype(int).clip(min=0) + def generate_only_instance_for_us(self, samples: int) -> List[MCutGraphData]: + nx_graphs = [self.generate_func() for _ in range(samples)] + self.solver.from_nx_graph(nx_graphs=nx_graphs) + return self.solver.graph_data + def generate(self): start_time = time.time() for _ in tqdm( diff --git a/ml4co_kit/solver/atsp/lkh.py b/ml4co_kit/solver/atsp/lkh.py index 7e968a8..7c9e44e 100644 --- a/ml4co_kit/solver/atsp/lkh.py +++ b/ml4co_kit/solver/atsp/lkh.py @@ -1,5 +1,4 @@ import os -import time import uuid import pathlib import numpy as np @@ -8,7 +7,7 @@ from subprocess import check_call from ml4co_kit.solver.atsp.base import ATSPSolver from ml4co_kit.utils.type_utils import SOLVER_TYPE -from ml4co_kit.utils.time_utils import iterative_execution +from ml4co_kit.utils.time_utils import iterative_execution, Timer class ATSPLKHSolver(ATSPSolver): @@ -100,7 +99,8 @@ def solve( # prepare self.from_data(dists=dists, normalize=normalize) self.tmp_solver = ATSPSolver(scale=self.scale) - start_time = time.time() + timer = Timer(apply=show_time) + timer.start() # solve tours = list() @@ -126,14 +126,13 @@ def solve( tours.append(tour) # format - tours = np.array(tours) - if tours.ndim == 2 and tours.shape[0] == 1: - tours = tours[0] self.from_data(tours=tours, ref=False) - end_time = time.time() - if show_time: - print(f"Use Time: {end_time - start_time}") - return tours + + # show time + timer.end() + timer.show_time() + + return self.tours def __str__(self) -> str: return "ATSPLKHSolver" \ No newline at end of file diff --git a/ml4co_kit/solver/cvrp/hgs.py b/ml4co_kit/solver/cvrp/hgs.py index dbcae0d..35797c8 100644 --- a/ml4co_kit/solver/cvrp/hgs.py +++ b/ml4co_kit/solver/cvrp/hgs.py @@ -1,12 +1,11 @@ import os import uuid -import time import numpy as np from typing import Union from multiprocessing import Pool from ml4co_kit.solver.cvrp.base import CVRPSolver from ml4co_kit.utils.type_utils import SOLVER_TYPE -from ml4co_kit.utils.time_utils import iterative_execution +from ml4co_kit.utils.time_utils import iterative_execution, Timer from ml4co_kit.solver.cvrp.c_hgs import cvrp_hgs_solver, HGS_TMP_PATH @@ -87,9 +86,8 @@ def solve( depots=depots, points=points, demands=demands, capacities=capacities, norm=norm, normalize=normalize ) - - # start time - start_time = time.time() + timer = Timer(apply=show_time) + timer.start() # solve tours = list() @@ -127,9 +125,11 @@ def solve( # format self.from_data(tours=tours, ref=False) - end_time = time.time() - if show_time: - print(f"Use Time: {end_time - start_time}") + + # show time + timer.end() + timer.show_time() + return self.tours def __str__(self) -> str: diff --git a/ml4co_kit/solver/cvrp/lkh.py b/ml4co_kit/solver/cvrp/lkh.py index 44368e4..a85c64f 100644 --- a/ml4co_kit/solver/cvrp/lkh.py +++ b/ml4co_kit/solver/cvrp/lkh.py @@ -1,5 +1,4 @@ import os -import time import uuid import pathlib import numpy as np @@ -9,7 +8,7 @@ from ml4co_kit.utils import tsplib95 from ml4co_kit.solver.cvrp.base import CVRPSolver from ml4co_kit.utils.type_utils import SOLVER_TYPE -from ml4co_kit.utils.time_utils import iterative_execution +from ml4co_kit.utils.time_utils import iterative_execution, Timer class CVRPLKHSolver(CVRPSolver): @@ -145,9 +144,8 @@ def solve( capacities=capacities, norm=norm, normalize=normalize ) self.tmp_solver = CVRPSolver() - - # start time - start_time = time.time() + timer = Timer(apply=show_time) + timer.start() # solve tours = list() @@ -187,9 +185,11 @@ def solve( # format self.from_data(tours=tours, ref=False) - end_time = time.time() - if show_time: - print(f"Use Time: {end_time - start_time}") + + # show time + timer.end() + timer.show_time() + return self.tours def __str__(self) -> str: diff --git a/ml4co_kit/solver/cvrp/pyvrp.py b/ml4co_kit/solver/cvrp/pyvrp.py index 2afce48..38a103f 100644 --- a/ml4co_kit/solver/cvrp/pyvrp.py +++ b/ml4co_kit/solver/cvrp/pyvrp.py @@ -7,7 +7,7 @@ from pyvrp.stop import MaxRuntime from ml4co_kit.solver.cvrp.base import CVRPSolver from ml4co_kit.utils.type_utils import SOLVER_TYPE -from ml4co_kit.utils.time_utils import iterative_execution +from ml4co_kit.utils.time_utils import iterative_execution, Timer if sys.version_info.major == 3 and sys.version_info.minor == 8: @@ -54,9 +54,9 @@ def _solve( cvrp_model.add_vehicle_type(capacity=capacity, num_available=max_num_available) clients = [ cvrp_model.add_client( - self.round_func(nodes_coord[idx][0]), - self.round_func(nodes_coord[idx][1]), - self.round_func(demands[idx]) + int(self.round_func(nodes_coord[idx][0])), + int(self.round_func(nodes_coord[idx][1])), + int(self.round_func(demands[idx])) ) for idx in range(0, len(nodes_coord)) ] locations = [depot] + clients @@ -91,9 +91,8 @@ def solve( capacities=capacities, norm=norm, normalize=normalize ) self.round_func = self.get_round_func(round_func) - - # start time - start_time = time.time() + timer = Timer(apply=show_time) + timer.start() # solve tours = list() @@ -133,9 +132,11 @@ def solve( # format self.from_data(tours=tours) - end_time = time.time() - if show_time: - print(f"Use Time: {end_time - start_time}") + + # show time + timer.end() + timer.show_time() + return self.tours def __str__(self) -> str: diff --git a/ml4co_kit/solver/mcl/gurobi.py b/ml4co_kit/solver/mcl/gurobi.py index b05e74f..8668de4 100644 --- a/ml4co_kit/solver/mcl/gurobi.py +++ b/ml4co_kit/solver/mcl/gurobi.py @@ -23,7 +23,7 @@ def solve( graph_data: List[MClGraphData] = None, num_threads: int = 1, show_time: bool = False - ) -> np.ndarray: + ) -> List[MClGraphData]: # preparation if graph_data is not None: self.graph_data = graph_data diff --git a/ml4co_kit/solver/mcut/gurobi.py b/ml4co_kit/solver/mcut/gurobi.py index b70f930..74eeca0 100644 --- a/ml4co_kit/solver/mcut/gurobi.py +++ b/ml4co_kit/solver/mcut/gurobi.py @@ -22,7 +22,7 @@ def solve( graph_data: List[MCutGraphData] = None, num_threads: int = 1, show_time: bool = False - ) -> np.ndarray: + ) -> List[MCutGraphData]: # preparation if graph_data is not None: self.graph_data = graph_data diff --git a/ml4co_kit/solver/mis/gurobi.py b/ml4co_kit/solver/mis/gurobi.py index b46477a..7482810 100644 --- a/ml4co_kit/solver/mis/gurobi.py +++ b/ml4co_kit/solver/mis/gurobi.py @@ -22,7 +22,7 @@ def solve( graph_data: List[MISGraphData] = None, num_threads: int = 1, show_time: bool = False - ) -> np.ndarray: + ) -> List[MISGraphData]: # preparation if graph_data is not None: self.graph_data = graph_data diff --git a/ml4co_kit/solver/mis/kamis.py b/ml4co_kit/solver/mis/kamis.py index 407c94d..57547a3 100644 --- a/ml4co_kit/solver/mis/kamis.py +++ b/ml4co_kit/solver/mis/kamis.py @@ -9,9 +9,10 @@ import networkx as nx from tqdm import tqdm from pathlib import Path -from typing import Union -from ml4co_kit.utils.type_utils import SOLVER_TYPE +from typing import Union, List from ml4co_kit.solver.mis.base import MISSolver +from ml4co_kit.utils.graph.mis import MISGraphData +from ml4co_kit.utils.type_utils import SOLVER_TYPE class KaMISSolver(MISSolver): @@ -82,7 +83,7 @@ def prepare_instance( def solve( self, src: Union[str, pathlib.Path], out: Union[str, pathlib.Path], - ): + ) -> List[MISGraphData]: message = ( "Please check KaMIS compilation. " "you can try ``self.recompile_kamis()``. " @@ -101,6 +102,7 @@ def solve( self.from_gpickle_result_folder( gpickle_folder_path=src, result_folder_path=out, ref=False, cover=True ) + return self.graph_data def _solve(self, src: Union[str, pathlib.Path], out: Union[str, pathlib.Path]): src = Path(src) diff --git a/ml4co_kit/solver/mvc/gurobi.py b/ml4co_kit/solver/mvc/gurobi.py index c5f792b..2f07f19 100644 --- a/ml4co_kit/solver/mvc/gurobi.py +++ b/ml4co_kit/solver/mvc/gurobi.py @@ -22,7 +22,7 @@ def solve( graph_data: List[MVCGraphData] = None, num_threads: int = 1, show_time: bool = False - ) -> np.ndarray: + ) -> List[MVCGraphData]: # preparation if graph_data is not None: self.graph_data = graph_data diff --git a/ml4co_kit/solver/tsp/c_ga_eax_large/__init__.py b/ml4co_kit/solver/tsp/c_ga_eax_large/__init__.py index 091976c..6377ef6 100644 --- a/ml4co_kit/solver/tsp/c_ga_eax_large/__init__.py +++ b/ml4co_kit/solver/tsp/c_ga_eax_large/__init__.py @@ -21,13 +21,13 @@ def tsp_ga_eax_large_solve( max_trials: int, sol_name: str, population_num: int, - offspring_num: int, tsp_name: str, + offspring_num: int, tsp_name: str, show_info: bool = False ): tsp_path = os.path.join("tmp", tsp_name) sol_path = os.path.join("tmp", sol_name) ori_dir = os.getcwd() os.chdir(GA_EAX_LARGE_BASE_PATH) - command = f"./ga_eax_large_solver {max_trials} {sol_path} {population_num} {offspring_num} {tsp_path}" + command = f"./ga_eax_large_solver {max_trials} {sol_path} {population_num} {offspring_num} {tsp_path} {show_info}" os.system(command) os.chdir(ori_dir) diff --git a/ml4co_kit/solver/tsp/c_ga_eax_large/env.cpp b/ml4co_kit/solver/tsp/c_ga_eax_large/env.cpp index d14e73b..2787504 100644 --- a/ml4co_kit/solver/tsp/c_ga_eax_large/env.cpp +++ b/ml4co_kit/solver/tsp/c_ga_eax_large/env.cpp @@ -71,8 +71,9 @@ void TEnvironment::DoIt() while( 1 ) { this->SetAverageBest(); - printf( "%d: %d %lf\n", fCurNumOfGen, fBestValue, fAverageValue ); - + if (showInfo){ + printf( "%d: %d %lf\n", fCurNumOfGen, fBestValue, fAverageValue ); + } if( this->TerminationCondition() ) break; this->SelectForMating(); diff --git a/ml4co_kit/solver/tsp/c_ga_eax_large/env.h b/ml4co_kit/solver/tsp/c_ga_eax_large/env.h index 52b0fab..ca454ce 100644 --- a/ml4co_kit/solver/tsp/c_ga_eax_large/env.h +++ b/ml4co_kit/solver/tsp/c_ga_eax_large/env.h @@ -80,6 +80,8 @@ class TEnvironment { int fMaxStagBest; /* If fStagBest = fMaxStagBest, proceed to the next stage */ int fCurNumOfGen1; /* Number of generations at which Stage I is terminated */ + int showInfo; + clock_t fTimeStart, fTimeInit, fTimeEnd; /* Use them to measure the execution time */ }; diff --git a/ml4co_kit/solver/tsp/c_ga_eax_large/main.cpp b/ml4co_kit/solver/tsp/c_ga_eax_large/main.cpp index 5f4c536..f93ed24 100644 --- a/ml4co_kit/solver/tsp/c_ga_eax_large/main.cpp +++ b/ml4co_kit/solver/tsp/c_ga_eax_large/main.cpp @@ -24,8 +24,10 @@ int main( int argc, char* argv[] ) gEnv->fNumOfKids = d; gEnv->fFileNameTSP = argv[5]; gEnv->fFileNameInitPop = NULL; - if( argc == 7 ) - gEnv->fFileNameInitPop = argv[6]; + sscanf( argv[6], "%d", &d ); + gEnv->showInfo = d; + if( argc == 8 ) + gEnv->fFileNameInitPop = argv[7]; gEnv->Define(); @@ -33,7 +35,7 @@ int main( int argc, char* argv[] ) { gEnv->DoIt(); - gEnv->PrintOn( n, dstFile ); + if (gEnv->showInfo){gEnv->PrintOn( n, dstFile );} gEnv->WriteBest( dstFile ); // gEnv->WritePop( n, dstFile ); } diff --git a/ml4co_kit/solver/tsp/c_ga_eax_normal/__init__.py b/ml4co_kit/solver/tsp/c_ga_eax_normal/__init__.py index ca0120b..beb52f5 100644 --- a/ml4co_kit/solver/tsp/c_ga_eax_normal/__init__.py +++ b/ml4co_kit/solver/tsp/c_ga_eax_normal/__init__.py @@ -21,13 +21,14 @@ def tsp_ga_eax_normal_solve( max_trials: int, sol_name: str, population_num: int, - offspring_num: int, tsp_name: str, + offspring_num: int, tsp_name: str, show_info: bool = False ): + show_info = 1 if show_info else 0 tsp_path = os.path.join("tmp", tsp_name) sol_path = os.path.join("tmp", sol_name) ori_dir = os.getcwd() os.chdir(GA_EAX_NORMAL_BASE_PATH) - command = f"./ga_eax_normal_solver {max_trials} {sol_path} {population_num} {offspring_num} {tsp_path}" + command = f"./ga_eax_normal_solver {max_trials} {sol_path} {population_num} {offspring_num} {tsp_path} {show_info}" os.system(command) os.chdir(ori_dir) diff --git a/ml4co_kit/solver/tsp/c_ga_eax_normal/env.cpp b/ml4co_kit/solver/tsp/c_ga_eax_normal/env.cpp index b86180f..473844d 100644 --- a/ml4co_kit/solver/tsp/c_ga_eax_normal/env.cpp +++ b/ml4co_kit/solver/tsp/c_ga_eax_normal/env.cpp @@ -71,8 +71,9 @@ void TEnvironment::DoIt() while( 1 ) { this->SetAverageBest(); - printf( "%d: %d %lf\n", fCurNumOfGen, fBestValue, fAverageValue ); - + if (showInfo){ + printf( "%d: %d %lf\n", fCurNumOfGen, fBestValue, fAverageValue ); + } if( this->TerminationCondition() ) break; this->SelectForMating(); diff --git a/ml4co_kit/solver/tsp/c_ga_eax_normal/env.h b/ml4co_kit/solver/tsp/c_ga_eax_normal/env.h index 52b0fab..ca454ce 100644 --- a/ml4co_kit/solver/tsp/c_ga_eax_normal/env.h +++ b/ml4co_kit/solver/tsp/c_ga_eax_normal/env.h @@ -80,6 +80,8 @@ class TEnvironment { int fMaxStagBest; /* If fStagBest = fMaxStagBest, proceed to the next stage */ int fCurNumOfGen1; /* Number of generations at which Stage I is terminated */ + int showInfo; + clock_t fTimeStart, fTimeInit, fTimeEnd; /* Use them to measure the execution time */ }; diff --git a/ml4co_kit/solver/tsp/c_ga_eax_normal/main.cpp b/ml4co_kit/solver/tsp/c_ga_eax_normal/main.cpp index 5f4c536..76678da 100644 --- a/ml4co_kit/solver/tsp/c_ga_eax_normal/main.cpp +++ b/ml4co_kit/solver/tsp/c_ga_eax_normal/main.cpp @@ -24,16 +24,17 @@ int main( int argc, char* argv[] ) gEnv->fNumOfKids = d; gEnv->fFileNameTSP = argv[5]; gEnv->fFileNameInitPop = NULL; - if( argc == 7 ) - gEnv->fFileNameInitPop = argv[6]; + sscanf( argv[6], "%d", &d ); + gEnv->showInfo = d; + if( argc == 8 ) + gEnv->fFileNameInitPop = argv[7]; gEnv->Define(); for( int n = 0; n < maxNumOfTrial; ++n ) { gEnv->DoIt(); - - gEnv->PrintOn( n, dstFile ); + if (gEnv->showInfo){gEnv->PrintOn( n, dstFile );} gEnv->WriteBest( dstFile ); // gEnv->WritePop( n, dstFile ); } diff --git a/ml4co_kit/solver/tsp/concorde.py b/ml4co_kit/solver/tsp/concorde.py index c015645..2826c19 100644 --- a/ml4co_kit/solver/tsp/concorde.py +++ b/ml4co_kit/solver/tsp/concorde.py @@ -1,5 +1,4 @@ import os -import time import uuid import numpy as np from typing import Union diff --git a/ml4co_kit/solver/tsp/ga_eax_large.py b/ml4co_kit/solver/tsp/ga_eax_large.py index 3ecbe92..60cbdf2 100644 --- a/ml4co_kit/solver/tsp/ga_eax_large.py +++ b/ml4co_kit/solver/tsp/ga_eax_large.py @@ -1,5 +1,4 @@ import os -import time import uuid import numpy as np from typing import Union @@ -20,6 +19,7 @@ def __init__( max_trials: int = 1, population_num: int = 300, offspring_num: int = 30, + show_info: bool = False ): super(TSPGAEAXLargeSolver, self).__init__( solver_type=SOLVER_TYPE.GA_EAX_LARGE, scale=scale @@ -27,7 +27,8 @@ def __init__( self.max_trials = max_trials self.population_num = population_num self.offspring_num = offspring_num - + self.show_info = show_info + def read_solution(self, file_path: str) -> np.ndarray: with open(file_path, 'r') as file: lines = file.readlines() @@ -62,8 +63,10 @@ def _solve(self, nodes_coord: np.ndarray) -> list: # solve tsp_ga_eax_large_solve( - max_trials=self.max_trials, sol_name=name, population_num=self.population_num, - offspring_num=self.offspring_num, tsp_name=tsp_abs_path + max_trials=self.max_trials, sol_name=name, + population_num=self.population_num, + offspring_num=self.offspring_num, + tsp_name=tsp_abs_path, show_info=self.show_info ) # read data from .sol @@ -116,7 +119,6 @@ def solve( tours.append(tour) # format - tours = np.array(tours) self.from_data(tours=tours, ref=False) # show time diff --git a/ml4co_kit/solver/tsp/ga_eax_normal.py b/ml4co_kit/solver/tsp/ga_eax_normal.py index 8e0ff9c..0b26701 100644 --- a/ml4co_kit/solver/tsp/ga_eax_normal.py +++ b/ml4co_kit/solver/tsp/ga_eax_normal.py @@ -1,5 +1,4 @@ import os -import time import uuid import numpy as np from typing import Union @@ -17,9 +16,10 @@ class TSPGAEAXSolver(TSPSolver): def __init__( self, scale: int = 1e5, - max_trials: int = 10, + max_trials: int = 1, population_num: int = 100, offspring_num: int = 30, + show_info: bool = False ): super(TSPGAEAXSolver, self).__init__( solver_type=SOLVER_TYPE.GA_EAX, scale=scale @@ -27,7 +27,8 @@ def __init__( self.max_trials = max_trials self.population_num = population_num self.offspring_num = offspring_num - + self.show_info = show_info + def read_solution(self, file_path: str) -> np.ndarray: with open(file_path, 'r') as file: lines = file.readlines() @@ -62,8 +63,10 @@ def _solve(self, nodes_coord: np.ndarray) -> list: # solve tsp_ga_eax_normal_solve( - max_trials=self.max_trials, sol_name=name, population_num=self.population_num, - offspring_num=self.offspring_num, tsp_name=tsp_abs_path + max_trials=self.max_trials, sol_name=name, + population_num=self.population_num, + offspring_num=self.offspring_num, + tsp_name=tsp_abs_path, show_info=self.show_info ) # read data from .sol @@ -116,7 +119,6 @@ def solve( tours.append(tour) # format - tours = np.array(tours) self.from_data(tours=tours, ref=False) # show time diff --git a/ml4co_kit/solver/tsp/lkh.py b/ml4co_kit/solver/tsp/lkh.py index d2366a0..a110f25 100644 --- a/ml4co_kit/solver/tsp/lkh.py +++ b/ml4co_kit/solver/tsp/lkh.py @@ -1,6 +1,5 @@ -import time -import numpy as np import pathlib +import numpy as np from typing import Union from multiprocessing import Pool from ml4co_kit.utils import tsplib95 diff --git a/ml4co_kit/utils/__init__.py b/ml4co_kit/utils/__init__.py index 9372caa..9460f09 100644 --- a/ml4co_kit/utils/__init__.py +++ b/ml4co_kit/utils/__init__.py @@ -1,6 +1,6 @@ from .file_utils import download, compress_folder, extract_archive, _get_md5 from .type_utils import to_numpy -from .time_utils import iterative_execution, iterative_execution_for_file +from .time_utils import iterative_execution, iterative_execution_for_file, Timer from .graph import np_dense_to_sparse, np_sparse_to_dense, GraphData from .graph import MISGraphData, MVCGraphData, MCutGraphData, MClGraphData from .distance_utils import geographical diff --git a/ml4co_kit/utils/type_utils.py b/ml4co_kit/utils/type_utils.py index fd17800..2c6ae1c 100644 --- a/ml4co_kit/utils/type_utils.py +++ b/ml4co_kit/utils/type_utils.py @@ -15,7 +15,7 @@ def to_numpy(x: Union[np.ndarray, list]): class TASK_TYPE(str, Enum): ATSP = "Asymmetric Traveling Salesman Problem (ATSP)" CVRP = "Capacitated Vehicle Routing Problem (CVRP)" - MCl = "Maximum Clique (MCL)" + MCl = "Maximum Clique (MCl)" MCut = "Maximum Cut (MCut)" MIS = "Maximum Independent Set (MIS)" MVC = "Minimum Vertex Cover (MVC)" @@ -30,7 +30,14 @@ class SOLVER_TYPE(str, Enum): GUROBI = "Gurobi" # Support for MIS, MVC, MC, MCL HGS = "HGS" # Support CVRP KAMIS = "KaMIS" # Support MIS - LKH = "LKH" # Support for TSP, ATSP, CVRP + LKH = "LKH" # Support for TSP, ATSP, CVRP + ML4ATSP = "ML4ATSP" # part of ML4CO + ML4CVRP = "ML4CVRP" # part of ML4CO + ML4MCl = "ML4MCl" # part of ML4CO + ML4MCut = "ML4MCut" # part of ML4CO + ML4MIS = "ML4MIS" # part of ML4CO + ML4MVC = "ML4MVC" # part of ML4CO + ML4TSP = "ML4TSP" # part of ML4CO PYVRP = "PyVRP" # Support CVRP