Appending Basin-Hopping Output

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Appending Basin-Hopping Output

msalperen
This post has NOT been accepted by the mailing list yet.
I'm trying to append x and fun from the dictionary output of basin-hopping simulation. But I can only append one of them at once, how can I extract both 'x' and 'fun' together, so that I can further process the results? (Below is the example code)

from math import *
from math import ceil
from math import floor
import time
from decimal import *
import numpy as np
from scipy.optimize import basinhopping
minimizer_kwargs = {"method": "BFGS"}

def f(x):

    b = 5306246123
    estimator1=(sqrt(b)+x[0])
    estimator2=(sqrt(b)+x[1])
    d=abs(estimator1*estimator2-b)
    return d

b = 5306246123

results = []
for x in range(3): results.append(basinhopping(f, [1,1], minimizer_kwargs=minimizer_kwargs,
niter=1000, stepsize=sqrt(sqrt(b)))['x'])
print(results)
Loading...