/usr/share/pyshared/openopt/kernel/IP.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 | from baseProblem import NonLinProblem
#from numpy.linalg import norm
from numpy import inf
class IP(NonLinProblem):
probType = 'IP'
goal = 'solution'
allowedGoals = ['solution']
showGoal = False
_optionalData = []
expectedArgs = ['f', 'domain']
ftol = None
def __init__(self, *args, **kwargs):
NonLinProblem.__init__(self, *args, **kwargs)
domain = args[1]
self.x0 = dict([(v, 0.5*(val[0]+val[1])) for v, val in domain.items()])
self.constraints = [v>bounds[0] for v, bounds in domain.items()] + [v<bounds[1] for v, bounds in domain.items()]
#self.data4TextOutput = ['objFunVal', 'residual']
self._Residual = inf
def objFunc(self, x):
return 0
#raise 'unimplemented yet'
#r = norm(dot(self.C, x) - self.d) ** 2 / 2.0
#return r
|