Project-Platypus / Platypus

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

Update core.py by adding 'objectives_normalized_values' function #233

Closed debpal closed 2 months ago

debpal commented 2 months ago

When I use platypus.normalize(algorithm.result), it calls the normalize function from playpus.tools and gives error due to 'is_zero' function. To call the actual 'normalize' function, the user needs to use platypus.core.normalize and it returns maximum and minimum interval only with normalized values as attributes of Solution. However, this process is difficult to understand for a user.

dhadka commented 2 months ago

Hi, thank you for submitting this PR! I think in this case we should fix the conflicting names by replacing the import * that is causing both platypus.core.normalize and platypus.tools.normalize to show up.

Ideally, platypus.tools should be for internal use, though some users might have taken a dependency on it. However, I think even with my changes below, users can still access them with from platypus.tools import normalize.

I put together a fix in https://github.com/Project-Platypus/Platypus/pull/234 if you want to checkout that branch and test it.