Skip to content

Commit 3e55137

Browse files
committed
verbose obj_fun added
1 parent df8d7bd commit 3e55137

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

epde/operators/multiobjective/moeadd_specific.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from epde.optimizers.moeadd.moeadd import ParetoLevels, ObjFunNormalizer
1515
from epde.operators.utils.template import CompoundOperator, add_base_param_to_operator
16+
import epde.globals as global_var
1617
from epde.operators.multiobjective.mutations import get_basic_mutation
1718

1819
from epde.structure.main_structures import SoEq
@@ -447,10 +448,12 @@ def apply(self, objective: ParetoLevels, arguments: dict):
447448
self.suboperators['pareto_level_updater'].apply(objective=(temp_offspring, objective),
448449
arguments=subop_args['pareto_level_updater'])
449450
objective.history.add(system)
450-
print(temp_offspring.obj_fun)
451+
if global_var.verbose.candidate_objectives:
452+
print(temp_offspring.obj_fun)
451453
break
452454
if replaced == offspring_attempt_limit:
453-
print("Could not generate unique offspring")
455+
if global_var.verbose.candidate_objectives:
456+
print("Could not generate unique offspring")
454457
break
455458
if attempt == mutation_attempt_limit:
456459
temp_offspring.create()
@@ -533,7 +536,8 @@ def apply(self, objective : ParetoLevels, arguments : dict):
533536
self.suboperators['chromosome_fitness'].apply(objective=candidate,
534537
arguments=subop_args['chromosome_fitness'])
535538
objective.history.add(system)
536-
print(candidate.obj_fun)
539+
if global_var.verbose.candidate_objectives:
540+
print(candidate.obj_fun)
537541
objective.associate_weights()
538542
objective.initial_placing()
539543

epde/structure/main_structures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ def add_random_term(self):
722722
mandatory_family=None, passed_term=None)
723723

724724
attempt = 0
725-
while new_term.term_label in self.terms_labels and attempt < 10:
725+
while new_term.term_label in self.terms_labels or attempt < 10:
726726
new_term.randomize()
727727
attempt += 1
728728

0 commit comments

Comments
 (0)