Ask Your Question
2

Scatter search optimisation

asked 2017-11-18 23:46:44 +0100

SloopJohnB gravatar image

Hi all,

Does Sage offer something similar to the scatter search algorithms (Global Optimisation Toolbox) in Matlab? I looked through Sage documentation and through this forum but couldn't find a comprehensive answer.

Bit of background: I have a model with 6 parameters that together govern two probability distributions, looking to minimise error between calculated output and a target consisting of 4 variables. The probability distribution interacts with 1,000 - 100,000 data points to give a yes/no decision for each so they can be included/excluded in a sub-sample of data.

Excel (Evolutionary Solver) runs this in 1 - 24hr (admittedly on a 64Gb ram/12 core work station) so understandably I would like to speed this up. Python looks a sensible way to go, which brought me to Sage, but I got stuck trying to find out what optimisation algorithms are available.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-11-20 00:44:52 +0100

mforets gravatar image

updated 2017-11-20 07:10:57 +0100

what optimisation algorithms are available.

Check those provided by SciPy's optimization and root finding library. All of them are available through the Sage interpreter by calling the appropriate scipy.optimize function. For example, the basin-hopping algorithm finds the global minimum of a scalar function:

sage: import numpy as np
sage: from scipy.optimize import basinhopping
sage: func = lambda x: np.cos(14.5 * x - 0.3) + (x + 0.2) * x
sage: x0=[1.]
sage: minimizer_kwargs = {"method": "BFGS"}
sage: ret = basinhopping(func, x0, minimizer_kwargs=minimizer_kwargs, niter=200)

                                              fun: -1.0008761844426548
          lowest_optimization_result:       fun: -1.0008761844426548
...

In some (but not all) cases, Sage provides an interface to these algorithms, so that you can directly use Sage symbolic functions as arguments.

It is worth mentioning that "out there" you'll find dozens of Python libraries for mathematical optimization (*). Notice that standard Python packages can be installed with the terminal command

$ sage --pip install --user package_name

and if the installation goes well, it is available the next time you start Sage via import package_name.


(*) See eg.:

edit flag offensive delete link more
0

answered 2017-11-20 21:09:04 +0100

SloopJohnB gravatar image

Thanks, exactly what I was hoping for! I thought there must be loads of optimisation programmes but clearly looked in the wrong place.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-11-18 23:46:44 +0100

Seen: 492 times

Last updated: Nov 20 '17