|
15 | 15 | from greyjack.agents.base.ParallelizationBackend import ParallelizationBackend
|
16 | 16 | from greyjack.agents.base.LoggingLevel import LoggingLevel
|
17 | 17 | from greyjack.agents.termination_strategies import *
|
18 |
| -from greyjack.Solver import Solver |
| 18 | +from greyjack.SolverOOP import SolverOOP |
19 | 19 | from greyjack.agents import *
|
20 | 20 |
|
21 | 21 | if __name__ == "__main__":
|
|
33 | 33 | #file_path = Path(data_dir_path, data_dir_path, "belgium", "basic", "air", "belgium-n1000-k40.vrp") #optimum: ~57.7; first_fit: ~195.3; RoutingModel: from 67.3 to 74 (depends on time)
|
34 | 34 | # multi-depot with timewindows
|
35 | 35 | #file_path = Path(data_dir_path, "belgium", "multidepot-timewindowed", "air", "belgium-tw-d2-n50-k10.vrp") # optimum: ~15.98; first_fit: ~27.89
|
36 |
| - file_path = Path(data_dir_path, "belgium", "multidepot-timewindowed", "air", "belgium-tw-d5-n500-k20.vrp") # optimum: ~43.3; first_fit: ~124.884 |
| 36 | + #file_path = Path(data_dir_path, "belgium", "multidepot-timewindowed", "air", "belgium-tw-d5-n500-k20.vrp") # optimum: ~43.3; first_fit: ~124.884 |
37 | 37 | #file_path = Path(data_dir_path, "belgium", "multidepot-timewindowed", "air", "belgium-tw-d8-n1000-k40.vrp") # optimum: ~58.1; first_fit: ~154.565
|
38 |
| - #file_path = Path(data_dir_path, "belgium", "multidepot-timewindowed", "air", "belgium-tw-d10-n2750-k55.vrp") # optimum: ~111; first_fit: ~380.9 |
| 38 | + file_path = Path(data_dir_path, "belgium", "multidepot-timewindowed", "air", "belgium-tw-d10-n2750-k55.vrp") # optimum: ~111; first_fit: ~380.9 |
39 | 39 |
|
40 | 40 | domain_builder = DomainBuilder(file_path)
|
41 | 41 | cotwin_builder = CotwinBuilder(use_incremental_score_calculator=True, use_greed_init=True)
|
42 | 42 |
|
43 | 43 | #termination_strategy = StepsLimit(step_count_limit=1000)
|
44 |
| - #termination_strategy = TimeSpentLimit(time_seconds_limit=60) |
45 |
| - termination_strategy = ScoreNoImprovement(time_seconds_limit=15) |
| 44 | + termination_strategy = TimeSpentLimit(time_seconds_limit=60) |
| 45 | + #termination_strategy = ScoreNoImprovement(time_seconds_limit=15) |
46 | 46 | #termination_strategy = ScoreLimit(score_to_compare=[0])
|
47 |
| - agent = TabuSearch(neighbours_count=1280, tabu_entity_rate=0.8, |
| 47 | + agent = TabuSearch(neighbours_count=128, tabu_entity_rate=0.8, |
48 | 48 | mutation_rate_multiplier=None, move_probas=[0.5, 0.5, 0.0, 0.0, 0.0, 0.0],
|
49 | 49 | migration_frequency=10, termination_strategy=termination_strategy)
|
50 | 50 | """agent = GeneticAlgorithm(population_size=128, crossover_probability=0.5, p_best_rate=0.05,
|
|
57 | 57 | mutation_rate_multiplier=None, move_probas=[0.5, 0.5, 0.0, 0.0, 0.0, 0.0],
|
58 | 58 | migration_frequency=10, termination_strategy=termination_strategy)"""
|
59 | 59 |
|
60 |
| - solver = Solver(domain_builder, cotwin_builder, agent, |
61 |
| - ParallelizationBackend.Multiprocessing, LoggingLevel.FreshOnly, |
| 60 | + solver = SolverOOP(domain_builder, cotwin_builder, agent, |
| 61 | + ParallelizationBackend.Multiprocessing, LoggingLevel.Info, |
62 | 62 | n_jobs=10, score_precision=[0, 0, 0])
|
63 | 63 | solution = solver.solve()
|
64 | 64 |
|
|
76 | 76 | agent = LateAcceptance(late_acceptance_size=64, tabu_entity_rate=0.05,
|
77 | 77 | mutation_rate_multiplier=None, move_probas=None,
|
78 | 78 | termination_strategy=termination_strategy)
|
79 |
| - solver = Solver(domain_builder, cotwin_builder, agent, |
| 79 | + solver = SolverOOP(domain_builder, cotwin_builder, agent, |
80 | 80 | ParallelizationBackend.Multiprocessing, LoggingLevel.FreshOnly,
|
81 | 81 | n_jobs=10, score_precision=[0, 0, 0],
|
82 | 82 | initial_solution=solution)
|
|
100 | 100 | agent = TabuSearch(neighbours_count=128, tabu_entity_rate=0.0,
|
101 | 101 | mutation_rate_multiplier=None, move_probas=[0.5, 0.5, 0.0, 0.0, 0.0, 0.0],
|
102 | 102 | migration_frequency=10, termination_strategy=termination_strategy)
|
103 |
| - solver = Solver(domain_builder, cotwin_builder, agent, |
| 103 | + solver = SolverOOP(domain_builder, cotwin_builder, agent, |
104 | 104 | ParallelizationBackend.Multiprocessing, LoggingLevel.FreshOnly,
|
105 | 105 | n_jobs=10, score_precision=[0, 0, 0],
|
106 | 106 | initial_solution=domain)
|
|
0 commit comments