Skip to content

Commit c3573a7

Browse files
committed
more specific Problem.__getstate__ fix for starmap parallelization
1 parent f6d6931 commit c3573a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pymoo/model/problem.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,12 @@ def calc_constraint_violation(G):
459459

460460
def __getstate__(self):
461461
state = self.__dict__.copy()
462-
state["parallelization"] = None
462+
463+
# If the parallelization is starmap,
464+
# we can't pickle self with the starmapper function.
465+
if state.get("parallelization", [None])[0] == "starmap":
466+
state["parallelization"] = None
467+
463468
return state
464469

465470
# makes all the output at least 2-d dimensional

0 commit comments

Comments
 (0)