Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
    def test_expo_discrete(self):
        i = (0.0,0.0)
        x = numpy.linspace(0,10,100)
        b = tuple((-10000,10000) for z in range(2))
        d = True

        a = tuple(spsp.reflect(bd,-500,500) for bd in sa.random_position(b))
        y = expo(x,*a)

        ags = (expo,x,y,a,i,b)
        kws = {
            'it':20,
            'discrete':d,
            'iterations':10000,
            'tolerance':0.0001}

        res,perror,derror,rtime = self.runf(*ags,**kws)
        if doplot:plot(x,expo,a,i,res)
        self.check('disrete expo',perror,derror,rtime)
Ejemplo n.º 3
0
    def test_bell_discrete(self):
        i = (0.0,0.0,0.0)
        x = numpy.linspace(-100,100,100)
        b = tuple((-10000,10000) for z in range(3))
        d = True

        a = sa.random_position(b)
        y = bell(x,*a)

        ags = (bell,x,y,a,i,b)
        kws = {
            'it':10,
            'discrete':d,
            'iterations':10000,
            'tolerance':0.0001}

        res,perror,derror,rtime = self.runf(*ags,**kws)
        if doplot:plot(x,bell,a,i,res)
        self.check('disrete bell',perror,derror,rtime)