/usr/share/pyshared/openopt/solvers/UkrOpt/amsg2p_oo.py is in python-openopt 0.38+svn1589-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | from openopt.kernel.baseSolver import *
#from openopt.kernel.Point import Point
#from openopt.kernel.setDefaultIterFuncs import *
from numpy import isfinite
from amsg2p import amsg2p as Solver
class amsg2p(baseSolver):
__name__ = 'amsg2p'
__license__ = "BSD"
__authors__ = "Dmitrey"
__alg__ = "Petro I. Stetsyuk, amsg2p"
__optionalDataThatCanBeHandled__ = []
iterfcnConnected = True
#_canHandleScipySparse = True
#default parameters
# T = float64
showRes = False
show_nnan = False
gamma = 1.0
# approach = 'all active'
def __init__(self): pass
def __solver__(self, p):
#assert self.approach == 'all active'
if not p.isUC: p.warn('Handling of constraints is not implemented properly for the solver %s yet' % self.__name__)
if p.fOpt is None:
if not isfinite(p.fEnough):
p.err('the solver %s requires providing optimal value fOpt')
else:
p.warn("you haven't provided optimal value fOpt for the solver %s; fEnough = %0.2e will be used instead" %(self.__name__, p.fEnough))
p.fOpt = p.fEnough
if p.fTol is None:
s = '''
the solver %s requires providing required objective function tolerance fTol
15*ftol = %0.1e will be used instead
''' % (self.__name__, p.ftol)
p.pWarn(s)
fTol = 15*p.ftol
else: fTol = p.fTol
def itefcn(*args, **kwargs):
p.iterfcn(*args, **kwargs)
return p.istop
x, itn = Solver(p.f, p.df, p.x0, fTol, p.fOpt, self.gamma, itefcn)
if p.f(x) < p.fOpt + fTol:
p.istop = 10
#p.iterfcn(x)
|