Skip to content

Commit

Permalink
Update optimizer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Evolutionary-Intelligence authored Jan 24, 2025
1 parent b80277f commit 1ad6596
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pypop7/optimizers/core/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,19 @@ def __init__(self, problem, options):
self.fitness_function = problem.get('fitness_function') # to be *minimized*
self.ndim_problem = problem.get('ndim_problem') # number of problem dimensionality
assert self.ndim_problem > 0
# mainly for the initialization process
# mainly for both the *initialization* process and the *constrained sampling* process:
# Constrained sampling is covered in its extended library called `PyCoPop7`
self.upper_boundary = problem.get('upper_boundary') # upper boundary of search range
self.lower_boundary = problem.get('lower_boundary') # lower boundary of search range
# only for the initialization process
# only for the *initialization* process
self.initial_upper_boundary = problem.get('initial_upper_boundary', self.upper_boundary)
self.initial_lower_boundary = problem.get('initial_lower_boundary', self.lower_boundary)
# mainly for the printing purpose
self.problem_name = problem.get('problem_name') # should be of data type `str`
if (self.problem_name is None) and hasattr(self.fitness_function, '__name__'):
self.problem_name = self.fitness_function.__name__

# optimizer-related options
# optimizer-related basic options
self.options = options
self.max_function_evaluations = options.get('max_function_evaluations', np.inf)
self.max_runtime = options.get('max_runtime', np.inf)
Expand Down

0 comments on commit 1ad6596

Please sign in to comment.