0

I am using SciPy differential_evolution to solve an optimization problem. I have a web application that I want to show the progress in. What would be a good technique for giving intermediate feedback of the optimization process? Does SciPy support the yield keyword?

1 Answer 1

0

You can gain feedback on solver process by providing a callback:

A callable called after each iteration. Has the signature:

callback(intermediate_result: OptimizeResult)

where intermediate_result is a keyword parameter containing an OptimizeResult with attributes x and fun, the best solution found so far and the objective function. Note that the name of the parameter must be intermediate_result for the callback to be passed an OptimizeResult.

The callback also supports a signature like:

callback(x, convergence: float=val)

val represents the fractional value of the population convergence. When val is greater than 1.0, the function halts.

Introspection is used to determine which of the signatures is invoked.

Global minimization will halt if the callback raises StopIteration or returns True; any polishing is still carried out.

That intermediate_result will also contain the current population.

differential_evolution does not use yield. However, the internal solver backend is an iterator. This backend is considered private.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.