|  | 
| 15 | 15 | from greyjack.Solver import Solver | 
| 16 | 16 | from greyjack.agents.base.LoggingLevel import LoggingLevel | 
| 17 | 17 | from greyjack.agents.base.ParallelizationBackend import ParallelizationBackend | 
| 18 |  | -from greyjack.agents.TabuSearch import TabuSearch | 
| 19 |  | -from greyjack.agents.GeneticAlgorithm import GeneticAlgorithm | 
| 20 |  | -from greyjack.agents.LateAcceptance import LateAcceptance | 
|  | 18 | +from greyjack.agents import * | 
| 21 | 19 | 
 | 
| 22 | 20 | if __name__ == "__main__": | 
| 23 | 21 | 
 | 
| 24 | 22 |     # build domain model | 
| 25 |  | -    domain_builder = DomainBuilderNQueens(1024, random_seed=45) | 
|  | 23 | +    domain_builder = DomainBuilderNQueens(10000, random_seed=45) | 
| 26 | 24 |     cotwin_builder = CotwinBuilderNQueens(use_incremental_score_calculator=True) | 
| 27 | 25 | 
 | 
| 28 | 26 |     #termination_strategy = StepsLimit(step_count_limit=1000) | 
| 29 |  | -    #termination_strategy = TimeSpentLimit(time_seconds_limit=60) | 
|  | 27 | +    termination_strategy = TimeSpentLimit(time_seconds_limit=60) | 
| 30 | 28 |     #termination_strategy = ScoreNoImprovement(time_seconds_limit=15) | 
| 31 |  | -    termination_strategy = ScoreLimit(score_to_compare=[0]) | 
|  | 29 | +    #termination_strategy = ScoreLimit(score_to_compare=[0]) | 
| 32 | 30 |     agent = TabuSearch(neighbours_count=20, tabu_entity_rate=0.0,  | 
| 33 | 31 |                        mutation_rate_multiplier=None, move_probas=[0, 1, 0, 0, 0, 0],  | 
| 34 | 32 |                        compare_to_global=True, migration_frequency=10, termination_strategy=termination_strategy) | 
| 35 | 33 |     """agent = GeneticAlgorithm(population_size=128, crossover_probability=0.5, p_best_rate=0.05, | 
| 36 | 34 |                              tabu_entity_rate=0.0, mutation_rate_multiplier=1.0, move_probas=[0, 1, 0, 0, 0, 0], | 
| 37 | 35 |                              migration_rate=0.00001, migration_frequency=1, termination_strategy=termination_strategy)""" | 
| 38 |  | -    """agent = LateAcceptance(late_acceptance_size=1, tabu_entity_rate=0.0,  | 
|  | 36 | +    """agent = LateAcceptance(late_acceptance_size=10, tabu_entity_rate=0.0,  | 
| 39 | 37 |                            mutation_rate_multiplier=None, move_probas=[0, 1, 0, 0, 0, 0],  | 
| 40 | 38 |                            termination_strategy=termination_strategy)""" | 
|  | 39 | +    """agent = SimulatedAnnealing(initial_temperature=[1.0], cooling_rate=0.9999, tabu_entity_rate=0.0,  | 
|  | 40 | +                               mutation_rate_multiplier=None, move_probas=[0, 1, 0, 0, 0, 0],  | 
|  | 41 | +                               compare_to_global=True, migration_frequency=10, termination_strategy=termination_strategy)""" | 
| 41 | 42 | 
 | 
| 42 | 43 |     solver = Solver(domain_builder, cotwin_builder, agent,  | 
| 43 |  | -                    ParallelizationBackend.Multiprocessing, LoggingLevel.Info, | 
|  | 44 | +                    ParallelizationBackend.Multiprocessing, LoggingLevel.FreshOnly, | 
| 44 | 45 |                     n_jobs=10, score_precision=[0]) | 
| 45 | 46 |     solution = solver.solve() | 
| 46 | 47 |     #print( "Cotwin solution looks that: " ) | 
|  | 
0 commit comments