Project-Platypus / Platypus

A Free and Open Source Python Library for Multiobjective Optimization
GNU General Public License v3.0
563 stars 153 forks source link

Pareto-front #155

Closed doup123 closed 3 years ago

doup123 commented 4 years ago

Is there a way to get and store all Pareto solutions?

Orbitography commented 3 years ago

Hi,

You can use the following code :


# define the problem definition
problem = DTLZ2()

# instantiate the optimization algorithm
algorithm = NSGAII(problem)

# optimize the problem using 10,000 function evaluations
algorithm.run(10000)

# display the results
for solution in algorithm.result:
    print(solution.objectives)

# keep only solutions that are part of the Pareto Front
nondominated_solutions = nondominated(algorithm.result)

Please check the documentation for an intro to Platypus https://platypus.readthedocs.io/en/latest/