/usr/share/pyshared/openopt/examples/llavp_1.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 | from numpy import empty, sin, cos, arange, ones
from openopt import LLAVP
M, N = 150, 15
C = empty((M,N))
d = empty(M)
for j in range(M):
d[j] = 1.5*N+80*sin(j)
C[j] = 8*sin(4.0+arange(N)) + 15*cos(j)
lb = sin(arange(N))
ub = lb + 1
p = LLAVP(C, d, lb=lb, ub=ub, dump = 10, X = ones(N), maxIter = 1e4, maxFunEvals = 1e100)
#optional: plot
p.plot=1
r = p.solve('nsp:ralg', iprint = 100, maxIter = 1000)
#r = p.solve('nsp:ipopt', iprint = 100, maxIter = 1000)
print('f_opt: %f' % r.ff)
#print 'x_opt:', r.xf
|