Skip to content

Commit

Permalink
Fix _adapt issue when using PSO with adaptive constraint handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
blankjul committed Mar 16, 2024
1 parent 8f30433 commit 262fd0f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pymoo/constraints/adaptive.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, algorithm):
def _setup(self, _, **kwargs):
self.evaluator = AttachConfigEvaluator(self.evaluator, self.config)

def _adapt(self, config, infills=None, **kwargs):
def _adapt_constraint_handling(self, config, infills=None, **kwargs):
pass

def _initialize_advance(self, infills=None, **kwargs):
Expand All @@ -53,7 +53,7 @@ def _advance(self, infills=None, **kwargs):
super()._advance(infills=infills, **kwargs)
copy_to_dict(self.default_config, self.config)

self._adapt(self.adapted_config, infills=infills, **kwargs)
self._adapt_constraint_handling(self.adapted_config, infills=infills, **kwargs)

def _infill(self):
copy_to_dict(self.adapted_config, self.config)
Expand Down
2 changes: 1 addition & 1 deletion pymoo/constraints/eps.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(self, algorithm, perc_eps_until=0.5):
self.perc_eps_until = perc_eps_until
self.max_cv = None

def _adapt(self, config, **kwargs):
def _adapt_constraint_handling(self, config, **kwargs):
t = self.termination.perc
alpha = np.maximum(0.0, 1 - 1 / self.perc_eps_until * t)
eps = alpha * self.max_cv
Expand Down

0 comments on commit 262fd0f

Please sign in to comment.