question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ENH: Return last population of scipy.optimize.differential_evolution

See original GitHub issue

Is your feature request related to a problem? Please describe.

Differential evolution is population based algorithm. However, scipy.optimize.differential_evolution returns result as OptimizeResult which gives only the best elite of the population ignoring the rest of its generation.

How can someone preserve information about the last population?

Describe the solution you’d like.

result.x should be the last population in sorted way. Otherwise, OptimizeResult should include a new attribute that memorizes the last population.

Describe alternatives you’ve considered.

Right now I have downloaded the source code to work with the class DifferentialEvolutionSolver directly. So it is possible to make this class available to be imported i.e: from scipy.optimize import DifferentialEvolutionSolver

Additional context (e.g. screenshots, GIFs)

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
Abduhucommented, Nov 20, 2021

Just as a matter of interest, is there a reason you’d like to see the final population (or even intermediate populations)? Note that the final population, if left to converge, is unlikely to have much variation in it. It would be an easy thing to return in the OptimizeResult, but I do wonder about the utility.

In some cases, users want to study the evolution of a specific optimization problem. Returning back the last population is enough since we can always continue evolution from it.

1reaction
andyfaffcommented, Nov 16, 2021

It’d require a bit of thought. Each minimizer is going to want to fill out slightly different attributes of an intermediate OptimizeResult. There would have to be a wrapper that could distinguish between the old/new signatures (e.g. state present as a keyword argument), but I’m not sure if (how much) the wrapper would have to be specialised for each method. It might require that each minimizer method has to be altered, which is not trivial.

I think it’d be worth discussing a design before a lot of code is written.

Read more comments on GitHub >

github_iconTop Results From Across the Web

scipy.optimize.differential_evolution — SciPy v1.9.3 Manual
Finds the global minimum of a multivariate function. Differential Evolution is stochastic in nature (does not use gradient methods) to find the minimum,...
Read more >
Why scipy.optimize.differential_evolution does not return last ...
One way I found to return the last population is to download the source code and work with the class DifferentialEvolutionSolver directly:
Read more >
modified _differentialevolution.py to enable parallel evaluation ...
However, I think scipy.optimize needs a common approach to enabling this kind of parallelisation. We don't want to have case-by-case approaches.
Read more >
Differential Evolution: An alternative to nonlinear convex ...
Differential Evolution (DE) (Storn & Price, 1997) is an Evolutionary Algorithm ... All of this will be performed using the scipy.optimize Python module....
Read more >
A Comparative Study of Differential Evolution Variants in ...
Differential evolution (DE) is a population-based metaheuristic search ... optimization problems are quite challenging to solve due to their ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found