예제 #1
0
 def __init__(self, model, noise_amplitude=1.0, **kwargs):
     """
     A noisy nonlinear problem in which only first derivatives can be
     evaluated. For help on individual methods, see `AmplModel`.
     """
     AmplModel.__init__(self, model, **kwargs)
     self.noise_amplitude = noise_amplitude
예제 #2
0
파일: noisynlp.py 프로젝트: syarra/nlpy
 def __init__(self, model, noise_amplitude=1.0, **kwargs):
     """
     A noisy nonlinear problem in which only first derivatives can be
     evaluated. For help on individual methods, see `AmplModel`.
     """
     AmplModel.__init__(self, model, **kwargs)
     self.noise_amplitude = noise_amplitude
예제 #3
0
 def cost(self):
     c = AmplModel.cost(self)
     for k in c.keys():
         c[k] += self.noise_amplitude * _random()
     return c
예제 #4
0
 def consPos(self, x):
     c = AmplModel.consPos(self, x)
     noise = _random_array(self.m)
     return c + self.noise_amplitude * noise
예제 #5
0
 def grad(self, x):
     g = AmplModel.grad(self, x)
     noise = _random_array(self.n)
     return g + self.noise_amplitude * noise
예제 #6
0
 def sgrad(self, x):
     sg = AmplModel.sgrad(self, x)
     for k in sg.keys():
         sg[k] += self.noise_amplitude * _random()
     return sg
예제 #7
0
 def A(self, *args):
     A = AmplModel.A(self, *args)
     noise = _random_array(A.nnz)
     (val, irow, jcol) = A.find()
     A.addAt(self.noise_amplitude * noise, irow, jcol)
     return A
예제 #8
0
파일: noisynlp.py 프로젝트: syarra/nlpy
 def sgrad(self, x):
     sg = AmplModel.sgrad(self, x)
     for k in sg.keys():
         sg[k] += self.noise_amplitude * _random()
     return sg
예제 #9
0
파일: noisynlp.py 프로젝트: syarra/nlpy
 def irow(self, i):
     row = AmplModel.irow(self, i)
     for k in row.keys():
         row[k] += self.noise_amplitude * _random()
     return row
예제 #10
0
 def sigrad(self, i, x):
     sgi = AmplModel.sigrad(self, i, x)
     for k in sgi.keys():
         sgi[k] += self.noise_amplitude * _random()
     return sgi
예제 #11
0
파일: noisynlp.py 프로젝트: syarra/nlpy
 def igrad(self, i, x):
     gi = AmplModel.igrad(self, i, x)
     noise = _random_array(self.n)
     return gi + self.noise_amplitude * noise
예제 #12
0
파일: noisynlp.py 프로젝트: syarra/nlpy
 def sigrad(self, i, x):
     sgi = AmplModel.sigrad(self, i, x)
     for k in sgi.keys():
         sgi[k] += self.noise_amplitude * _random()
     return sgi
예제 #13
0
파일: noisynlp.py 프로젝트: syarra/nlpy
 def icons(self, i, x):
     ci = AmplModel.icons(self, i, x)
     noise = _random()
     return ci + self.noise_amplitude * noise
예제 #14
0
파일: noisynlp.py 프로젝트: syarra/nlpy
 def consPos(self, x):
     c = AmplModel.consPos(self, x)
     noise = _random_array(self.m)
     return c + self.noise_amplitude * noise
예제 #15
0
파일: noisynlp.py 프로젝트: syarra/nlpy
 def cost(self):
     c = AmplModel.cost(self)
     for k in c.keys():
         c[k] += self.noise_amplitude * _random()
     return c
예제 #16
0
 def icons(self, i, x):
     ci = AmplModel.icons(self, i, x)
     noise = _random()
     return ci + self.noise_amplitude * noise
예제 #17
0
파일: noisynlp.py 프로젝트: syarra/nlpy
 def jac(self, x, *args):
     J = AmplModel.jac(self, x, *args)
     noise = _random_array(J.nnz)
     (val, irow, jcol) = J.find()
     J.addAt(self.noise_amplitude * noise, irow, jcol)
     return J
예제 #18
0
 def igrad(self, i, x):
     gi = AmplModel.igrad(self, i, x)
     noise = _random_array(self.n)
     return gi + self.noise_amplitude * noise
예제 #19
0
파일: noisynlp.py 프로젝트: syarra/nlpy
 def obj(self, x):
     f = AmplModel.obj(self, x)
     noise = _random()
     return f + self.noise_amplitude * noise
예제 #20
0
 def irow(self, i):
     row = AmplModel.irow(self, i)
     for k in row.keys():
         row[k] += self.noise_amplitude * _random()
     return row
예제 #21
0
 def obj(self, x):
     f = AmplModel.obj(self, x)
     noise = _random()
     return f + self.noise_amplitude * noise
예제 #22
0
 def jac(self, x, *args):
     J = AmplModel.jac(self, x, *args)
     noise = _random_array(J.nnz)
     (val, irow, jcol) = J.find()
     J.addAt(self.noise_amplitude * noise, irow, jcol)
     return J
예제 #23
0
파일: noisynlp.py 프로젝트: syarra/nlpy
 def grad(self, x):
     g = AmplModel.grad(self, x)
     noise = _random_array(self.n)
     return g + self.noise_amplitude * noise