コード例 #1
0
ファイル: evolve.py プロジェクト: Stargrazer82301/CAAPR
# Load the random state
load_state(random_path)

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

# Load the parameters table
parameters = tables.from_file(parameters_path, format="ascii.ecsv")

# Load the chi squared table
chi_squared = tables.from_file(chi_squared_path, format="ascii.ecsv")

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

# Load the GA
ga = GAEngine.from_file(path)

# Check whether the chi-squared and parameter tables match
for i in range(len(parameters)):
    assert parameters["Unique name"][i] == chi_squared["Unique name"][i]

# Get the scores
scores = chi_squared["Chi-squared"]
check = parameters

# Set the scores
ga.set_scores(scores, check)

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

new_generation = last_generation + 1 if last_generation is not None else 0
コード例 #2
0
# Load the random state
load_state(random_path)

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

# Load the parameters table
parameters = tables.from_file(parameters_path, format="ascii.ecsv")

# Load the chi squared table
chi_squared = tables.from_file(chi_squared_path, format="ascii.ecsv")

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

# Load the GA
ga = GAEngine.from_file(path)

# Check whether the chi-squared and parameter tables match
for i in range(len(parameters)):
    assert parameters["Unique name"][i] == chi_squared["Unique name"][i]

# Get the scores
scores = chi_squared["Chi-squared"]
check = parameters

# Set the scores
ga.set_scores(scores, check)

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

new_generation = last_generation + 1 if last_generation is not None else 0
コード例 #3
0
ファイル: explore.py プロジェクト: Stargrazer82301/CAAPR
# Inform the user
log.info("Creating the GA engine ...")

# Genome instance
genome = G1DList(2)
genome.setParams(rangemin=0., rangemax=50., bestrawscore=0.00, rounddecimal=2)
genome.initializator.set(initializators.G1DListInitializatorReal)
genome.mutator.set(mutators.G1DListMutatorRealGaussian)

#genome.evaluator.set(chi_squared_function)

# Inform the user
log.info("Creating the GA engine ...")

# Genetic algorithm instance
ga = GAEngine(genome)
ga.terminationCriteria.set(RawScoreCriteria)
ga.setMinimax(constants.minimaxType["minimize"])
ga.setGenerations(5)
ga.setCrossoverRate(0.5)
ga.setPopulationSize(100)
ga.setMutationRate(0.5)

# Initialize the genetic algorithm
ga.initialize()



name_column = []
par_a_column = []
par_b_column = []
コード例 #4
0
ファイル: reference.py プロジェクト: Stargrazer82301/CAAPR
seed = config.seed
prng = setup_prng(seed)

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

# Genome instance
genome = G1DList(2)
genome.setParams(rangemin=0., rangemax=50., bestrawscore=0.00, rounddecimal=2)
genome.initializator.set(initializators.G1DListInitializatorReal)
genome.mutator.set(mutators.G1DListMutatorRealGaussian)

# Set the evaluator function
genome.evaluator.set(chi_squared_function)

# Genetic algorithm instance
ga = GAEngine(genome)
ga.terminationCriteria.set(RawScoreCriteria)
ga.setMinimax(constants.minimaxType["minimize"])
ga.setGenerations(5)
ga.setCrossoverRate(0.5)
ga.setPopulationSize(100)
ga.setMutationRate(0.5)

# Evolve
#ga.evolve(freq_stats=False)
ga.evolve()

print("Final generation:", ga.currentGeneration)

# -----------------------------------------------------------------
コード例 #5
0
ファイル: explore.py プロジェクト: wdobbels/CAAPR
# Inform the user
log.info("Creating the GA engine ...")

# Genome instance
genome = G1DList(2)
genome.setParams(rangemin=0., rangemax=50., bestrawscore=0.00, rounddecimal=2)
genome.initializator.set(initializators.G1DListInitializatorReal)
genome.mutator.set(mutators.G1DListMutatorRealGaussian)

#genome.evaluator.set(chi_squared_function)

# Inform the user
log.info("Creating the GA engine ...")

# Genetic algorithm instance
ga = GAEngine(genome)
ga.terminationCriteria.set(RawScoreCriteria)
ga.setMinimax(constants.minimaxType["minimize"])
ga.setGenerations(5)
ga.setCrossoverRate(0.5)
ga.setPopulationSize(100)
ga.setMutationRate(0.5)

# Initialize the genetic algorithm
ga.initialize()

name_column = []
par_a_column = []
par_b_column = []

pop = ga.internalPop
コード例 #6
0
seed = config.seed
prng = setup_prng(seed)

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

# Genome instance
genome = G1DList(2)
genome.setParams(rangemin=0., rangemax=50., bestrawscore=0.00, rounddecimal=2)
genome.initializator.set(initializators.G1DListInitializatorReal)
genome.mutator.set(mutators.G1DListMutatorRealGaussian)

# Set the evaluator function
genome.evaluator.set(chi_squared_function)

# Genetic algorithm instance
ga = GAEngine(genome)
ga.terminationCriteria.set(RawScoreCriteria)
ga.setMinimax(constants.minimaxType["minimize"])
ga.setGenerations(5)
ga.setCrossoverRate(0.5)
ga.setPopulationSize(100)
ga.setMutationRate(0.5)

# Evolve
#ga.evolve(freq_stats=False)
ga.evolve()

print("Final generation:", ga.currentGeneration)

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