Skip to content

For multi-objective optimization, Lists of Saved Best Solution Causes Error When Loadedd #300

Open
@MommyMythra

Description

@MommyMythra

Howdy!

I have been using pygad for a while, but I just noticed when flipping on save_best_solutions, the saved solution list is converted into a list of ndarrays as opposed to a list of lists. This creates a fundamental issue on line 1682 (I think) where the comparison throws up an ambiguity error. Using Python 3.8.

Fixed by changing line at 1887 to
self.best_solutions = [arr.tolist() for arr in self.best_solutions]

May need to differentiate between multi-objective and single-objective optimization. This error may also exist with line 1893 with save_solutions.

Cheers,
Mythra

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions