/usr/share/pyshared/openopt/examples/glp_3.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 | from openopt import GLP
from numpy import *
N = 100
aN = arange(N)
f = lambda x: ((x-aN)**2).sum()
p = GLP(f, lb = -ones(N), ub = N*ones(N), maxIter = 1e3, maxFunEvals = 1e5, maxTime = 10, maxCPUTime = 300)
#optional: graphic output
#p.plot = 1
r = p.solve('de', plot=1, debug=1, iprint=0)
x_opt, f_opt = r.xf, r.ff
|