Project-Platypus/Platypus

Best solution from "solution.objectives"

RafaHPSUnicamp opened this issue · 3 comments

Hi,

I am trying to select the best result from a single objective problem, however since I am novice on Platypus, I do not know how to do that. Any suggestions to select the best solution from the vector of "solution.objectives". The same applies for variables.

I am needed that since I am comparing the Platypus with another optimization software.

Hey @RafaHPSUnicamp,

Please note that solution.objectives contains the objective values for a single result. For a single objective problem, solution.objectives will be an array containing a single value. Likewise, solution.variables contains the variables for that result.

To get the best result, you should use unique(nondominated(algorithm.result)). This returns the best result(s). There could be more than one result as they could have identical fitness (objective) values.

best = unique(nondominated(algorithm.result))[0]
best.objectives   # the objective value for the best result
best.variables    # the variables for the best result

Hi, thank you. Also, do you have an e-mail contact. I also send another issue to solve my code. I wrote my code, however, I discovered that restrictions does not working. The code is working, however the restrictions are being ignored for unknown reasons.

This issue is stale and will be closed soon. If you feel this issue is still relevant, please comment to keep it active. Please also consider working on a fix and submitting a PR.