Skip to content

Commit

Permalink
Fix anyoptimization#348: Serialization Error when Parallelizing with …
Browse files Browse the repository at this point in the history
…Processes
  • Loading branch information
blankjul committed Dec 15, 2022
1 parent eb8c27e commit feb31d0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pymoo/core/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def __init__(self,
elementwise=False,
elementwise_func=ElementwiseEvaluationFunction,
elementwise_runner=LoopedElementwiseEvaluation(),
requires_kwargs=False,
replace_nan_values_by=None,
exclude_from_serialization=None,
callback=None,
Expand Down Expand Up @@ -140,6 +141,9 @@ def __init__(self,
self.elementwise_func = elementwise_func
self.elementwise_runner = elementwise_runner

# whether evaluation requires kwargs (passing them can cause overhead in parallelization)
self.requires_kwargs = requires_kwargs

# whether the shapes are checked strictly
self.strict = strict

Expand Down Expand Up @@ -169,6 +173,10 @@ def evaluate(self,
return_as_dictionary=False,
**kwargs):

# if the problem does not require any kwargs they are re-initialized
if not self.requires_kwargs:
kwargs = dict()

if return_values_of is None:
return_values_of = ["F"]
if self.n_ieq_constr > 0:
Expand Down

0 comments on commit feb31d0

Please sign in to comment.