コード例 #1
0
ファイル: exponential_demo.py プロジェクト: ctogle/sim_anneal
def run_func(f,x,b = None,i = None,**ekwgs):

    dim = len(inspect.getargspec(f)[0])-1
    bounds = tuple(sa.bound(f,x,10**d,j,dim) for j in range(dim))
    actual = sa.random_position(bounds)
    y = f(x,*actual)

    result,derror = sa.run(f,x,y,b,i,**ekwgs)
    summary = summarize(f,x,i,actual,result,derror)
    return result,summary
コード例 #2
0
ファイル: sim_anneal_tests.py プロジェクト: ctogle/sim_anneal
 def runf(self,f,x,y,a,g,b,**kws):
     t = time.time()
     res,err = sa.run(f,x,y,b,g,**kws)
     perror = tuple(abs((r-a)/a)*100.0 for r,a in zip(res,a))
     return res,perror,err,time.time()-t