Example #1
0
names = ["Unique name", "Parameter a", "Parameter b"]
new_parameters_table = tables.new(data, names)

# -----------------------------------------------------------------

# Save the new parameters table
tables.write(new_parameters_table, new_parameters_path, format="ascii.ecsv")

# Dump the GA
ga.saveto(new_path)

# -----------------------------------------------------------------

# Save the state of the random generator
new_random_path = fs.join(new_generation_path, "rndstate.pickle")
save_state(new_random_path)

# -----------------------------------------------------------------

# Initialize evolution:
# self.initialize() # done in 'explore'
# self.internalPop.evaluate()
# self.internalPop.sort()


# Evaluate function of population is just loop over evaluate function of individuals
# Evaluate function of individual (genome) is just calculating the sum of scores of each target function


# newpop = ga.generate_new_population()
# for ind in newpop: print(ind.genomeList)
Example #2
0
for ind in pop:

    # Give the individual a unique name
    name = time.unique_name(precision="micro")
    name_column.append(name)
    par_a_column.append(ind.genomeList[0])
    par_b_column.append(ind.genomeList[1])

# Create the parameters table
data = [name_column, par_a_column, par_b_column]
names = ["Unique name", "Parameter a", "Parameter b"]
parameters_table = tables.new(data, names)

# Save the genetic algorithm
ga.saveto(path)

#print("Current generation: ", ga.currentGeneration)

# Save the parameter table
tables.write(parameters_table, parameters_path, format="ascii.ecsv")

# -----------------------------------------------------------------

# Path to the random state
random_path = fs.join(fs.cwd(), "rndstate.pickle")

# Save the state of the random generator
save_state(random_path)

# -----------------------------------------------------------------
Example #3
0
names = ["Unique name", "Parameter a", "Parameter b"]
new_parameters_table = tables.new(data, names)

# -----------------------------------------------------------------

# Save the new parameters table
tables.write(new_parameters_table, new_parameters_path, format="ascii.ecsv")

# Dump the GA
ga.saveto(new_path)

# -----------------------------------------------------------------

# Save the state of the random generator
new_random_path = fs.join(new_generation_path, "rndstate.pickle")
save_state(new_random_path)

# -----------------------------------------------------------------

# Initialize evolution:
# self.initialize() # done in 'explore'
# self.internalPop.evaluate()
# self.internalPop.sort()

# Evaluate function of population is just loop over evaluate function of individuals
# Evaluate function of individual (genome) is just calculating the sum of scores of each target function

# newpop = ga.generate_new_population()
# for ind in newpop: print(ind.genomeList)

#pop = ga.get_population()
Example #4
0
for ind in pop:

    # Give the individual a unique name
    name = time.unique_name(precision="micro")
    name_column.append(name)
    par_a_column.append(ind.genomeList[0])
    par_b_column.append(ind.genomeList[1])

# Create the parameters table
data = [name_column, par_a_column, par_b_column]
names = ["Unique name", "Parameter a", "Parameter b"]
parameters_table = tables.new(data, names)

# Save the genetic algorithm
ga.saveto(path)

#print("Current generation: ", ga.currentGeneration)

# Save the parameter table
tables.write(parameters_table, parameters_path, format="ascii.ecsv")

# -----------------------------------------------------------------

# Path to the random state
random_path = fs.join(fs.cwd(), "rndstate.pickle")

# Save the state of the random generator
save_state(random_path)

# -----------------------------------------------------------------