Skip to content

Commit

Permalink
More population changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alcides committed Oct 23, 2024
1 parent e1bba05 commit ca71e0f
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 13 deletions.
8 changes: 3 additions & 5 deletions examples/genetic_example/genetic_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@


class DecisionNode(ABC):
def evaluate(self, X):
...
def evaluate(self, X): ...


class IntNode(ABC):
def evaluate(self, X):
...
def evaluate(self, X): ...


@dataclass
Expand Down Expand Up @@ -101,7 +99,7 @@ def fitness_function(d: DecisionNode):
population_size=10,
max_evaluations=10000,
)
ind = alg.search()
ind = alg.search()[0]
print(ind)


Expand Down
2 changes: 1 addition & 1 deletion examples/pcfg_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def fitness_function(x) -> float:
population_size=1000,
max_evaluations=10 * 1000,
)
ind = alg.search()
ind = alg.search()[0]

x: TreeNode = ind.get_phenotype()
print(x)
2 changes: 1 addition & 1 deletion examples/progsys/Median.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def evolve(g, seed, mode, representation="treebased"):
population_size=50,
crossover_probability=0.9,
)
ind = alg.search()
ind = alg.search()[0]
return ind.get_phenotype(), ind.get_fitness(alg.get_problem()), g


Expand Down
2 changes: 1 addition & 1 deletion examples/progsys/Number_IO.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def evolve(g, seed, mode, representation="treebased"):
population_size=50,
crossover_probability=0.9,
)
ind = alg.search()
ind = alg.search()[0]
return ind.get_phenotype(), ind.get_fitness(alg.get_problem()), g


Expand Down
2 changes: 1 addition & 1 deletion examples/progsys/Smallest.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def evolve(g, seed, mode, representation="treebased"):
population_size=50,
crossover_probability=0.9,
)
ind = alg.search()
ind = alg.search()[0]
return ind.get_phenotype(), ind.get_fitness(alg.get_problem()), g


Expand Down
2 changes: 1 addition & 1 deletion examples/progsys/Sum_of_Squares.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def evolve(g, seed, mode, representation="treebased"):
population_size=50,
crossover_probability=0.9,
)
ind = alg.search()
ind = alg.search()[0]
return ind.get_phenotype(), ind.get_fitness(alg.get_problem()), g


Expand Down
2 changes: 1 addition & 1 deletion examples/progsys/Vector_Average.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def evolve(g, seed, mode, representation="treebased"):
population_size=50,
crossover_probability=0.9,
)
ind = alg.search()
ind = alg.search()[0]
return ind.get_phenotype(), ind.fitness, g


Expand Down
2 changes: 1 addition & 1 deletion examples/synthetic_grammar_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def fitness_function(n):
# ),
# ],
)
ind = alg.search()
ind = alg.search()[0]
print(ind)
print(f"With fitness: {ind.get_fitness(problem)}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@ def test_nodes_depth_specific_simple(self):
step=algorithm_steps(),
population_size=gp_parameters["population_size"],
)
ind = alg.search()
ind = alg.search()[0]
assert ind

0 comments on commit ca71e0f

Please sign in to comment.