Skip to content

OMOPSO with multi-process failed #159

@jacktang

Description

@jacktang

Hello,

I want run OMOPSO in parallel using multi-process, and the code looks like

problem = ZDT1()

mutation_probability = 1.0 / problem.number_of_variables
max_evaluations = 25000
swarm_size = 100

algorithm = OMOPSO(
    problem=problem,
    swarm_size=swarm_size,
    epsilon=0.0075,
    uniform_mutation=UniformMutation(probability=mutation_probability, perturbation=0.5),
    non_uniform_mutation=NonUniformMutation(mutation_probability, perturbation=0.5,
                                            max_iterations=int(max_evaluations / swarm_size)),
    leaders=CrowdingDistanceArchive(100),
    termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
    swarm_evaluator = MultiprocessEvaluator(processes=4),
)

and the error:

File ~/opt/miniconda3/lib/python3.9/site-packages/jmetal/core/algorithm.py:84, in Algorithm.run(self)
     82 LOGGER.debug('Running main loop until termination criteria is met')
     83 while not self.stopping_condition_is_met():
---> 84     self.step()
     85     self.update_progress()
     87 self.total_computing_time = time.time() - self.start_computing_time

File ~/opt/miniconda3/lib/python3.9/site-packages/jmetal/core/algorithm.py:222, in ParticleSwarmOptimization.step(self)
    220 self.update_position(self.solutions)
    221 self.perturbation(self.solutions)
--> 222 self.solutions = self.evaluate(self.solutions)
    223 self.update_global_best(self.solutions)
    224 self.update_particle_best(self.solutions)

File ~/opt/miniconda3/lib/python3.9/site-packages/jmetal/algorithm/multiobjective/omopso.py:93, in OMOPSO.evaluate(self, solution_list)
     92 def evaluate(self, solution_list: List[FloatSolution]):
---> 93     return self.swarm_evaluator.evaluate(solution_list, self.problem)
...
    769     return self._value
    770 else:
--> 771     raise self._value

MaybeEncodingError: Error sending result: '[<jmetal.core.solution.FloatSolution object at 0x7ff59f4abc40>, <jmetal.core.solution.FloatSolution object at 0x7ff5a2248a30>, <jmetal.core.solution.FloatSolution object at 0x7ff5a22d5820>, <jmetal.core.solution.FloatSolution object at 0x7ff5a2303ee0>, <jmetal.core.solution.FloatSolution object at 0x7ff5a20cb8b0>, <jmetal.core.solution.FloatSolution object at 0x7ff5a2012610>, <jmetal.core.solution.FloatSolution object at 0x7ff5a22b6340>]'. Reason: 'RecursionError('maximum recursion depth exceeded while calling a Python object')'

Is it a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions