Ejemplo n.º 1
0
    def setUp(self):
        self._num_points = 10
        self._pop_size = 5

        gen = TSPGenerator(self._num_points)
        self._data = gen.generate()
        self._distances = distance_matrix(self._data, self._data)
    def setUp(self):
        self._num_points = 10
        self._pop_size = 5

        gen = TSPGenerator(self._num_points)
        self._data = gen.generate()
        self._distances = distance_matrix(self._data, self._data)
Ejemplo n.º 3
0
    def setUp(self):
        self._num_points = 10
        self._pop_size = 5

        gen = TSPGenerator(self._num_points)
        self._data = gen.generate()
        self._distances = distance_matrix(self._data, self._data)

        popGen = SimplePopulationGenerator(self._pop_size)
        self._population = popGen.generate(self._data)
Ejemplo n.º 4
0
    def setUp(self):
        self._num_points = 10
        self._pop_size = 20

        gen = TSPGenerator(self._num_points)
        self._data = gen.generate()
        self._distances = distance_matrix(self._data, self._data)

        popGen = SimplePopulationGenerator(self._pop_size)
        self._population = popGen.generate(self._distances[0])
Ejemplo n.º 5
0
 def setUp(self):
     self._num_points = 30
     gen = TSPGenerator(self._num_points)
     self._data = gen.generate()
Ejemplo n.º 6
0
tuner = GeneticAlgorithmParameterEstimation(NUM_DATASETS, NUM_POINTS)
params = {
    "num_epochs": [1000],
    "num_elites": [0, 1, 2],
    "generator": ["SimplePopulationGenerator"],
    "generator_population_size": [40],
    "selector": ["TournamentSelection"],
    "selector_tournament_size": [10],
    "crossover": ["OrderCrossover"],
    "crossover_pcross": [0.9],
    "mutator": ["InversionMutation"],
    "mutator_pmutate": [0.2]
}
elite_results = tuner.perform_grid_search(params)
elite_results
gen = TSPGenerator(NUM_POINTS)
data = gen.generate()

all_fitness = []
for i, row in elite.iterrows():
    params = row.to_dict()
    sim = Simulator(**params)
    sim.evolve(data)
    all_fitness.append(sim.get_min_fitness()[::10])
    
df = pd.DataFrame(np.array(all_fitness))
gen = TSPGenerator(NUM_POINTS)
data = gen.generate()

all_fitness = []
for i, row in elite_results.iterrows():
Ejemplo n.º 7
0
 def setUp(self):
     self._num_points = 30
     gen = TSPGenerator(self._num_points)
     self._data = gen.generate()