Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions epde/operators/multiobjective/moeadd_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,18 +360,22 @@ def apply(self, objective: ParetoLevels, arguments: dict):
self.suboperators['chromosome_fitness'].apply(objective=temp_offspring,
arguments=subop_args['chromosome_fitness'])

if all([not np.allclose(temp_offspring.obj_fun, solution.obj_fun) for solution in objective.population]):
if (all([not np.allclose(temp_offspring.obj_fun, solution.obj_fun) for solution in objective.population])
and tuple(temp_offspring.obj_fun) not in objective.history):
# and all([not np.allclose(temp_offspring.obj_fun, obj_fun) for obj_fun in objective.history]):

self.suboperators['pareto_level_updater'].apply(objective=(temp_offspring, objective),
arguments=subop_args['pareto_level_updater'])
objective.history.add(tuple(temp_offspring.obj_fun))
break
elif replaced >= attempt_limit:
print("Allowed replication")
self.suboperators['pareto_level_updater'].apply(objective=(temp_offspring, objective),
arguments=subop_args['pareto_level_updater'])
break
# elif attempt >= attempt_limit and replaced:
# print("Allowed replication")
# self.suboperators['pareto_level_updater'].apply(objective=(temp_offspring, objective),
# arguments=subop_args['pareto_level_updater'])
# break
elif attempt >= attempt_limit:
temp_offspring.create()
replaced = True
replaced += 1
attempt = 1
self.suboperators['chromosome_mutation'].apply(objective=temp_offspring,
arguments=subop_args['chromosome_mutation'])
Expand Down Expand Up @@ -430,6 +434,7 @@ def apply(self, objective : ParetoLevels, arguments : dict):

self.suboperators['chromosome_fitness'].apply(objective = objective.unplaced_candidates[idx],
arguments = subop_args['chromosome_fitness'])
objective.history.add(tuple(candidate.obj_fun))
objective.initial_placing()
return objective

Expand Down
1 change: 1 addition & 0 deletions epde/optimizers/moeadd/moeadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(self, population, sorting_method = fast_non_dominated_sorting,
self.population = []
self._update_method = update_method
self.unplaced_candidates = population
self.history = set()

def manual_reconst(self, attribute:str, value, except_attrs:dict):
from epde.loader import attrs_from_dict
Expand Down