/usr/share/pyshared/openopt/examples/llsp_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 25 26 27 28 | __docformat__ = "restructuredtext en"
from numpy import empty, sin, cos, arange
from openopt import LLSP
M, N = 1500, 1000
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)
""" alternatively, try the sparse problem - lsqr solver can take benefits of it.
Also, if your C is too large for your RAM
you can pass C of any scipy.sparse matrix format
for j in xrange(M):
d[j] = 1.5*N+80*sin(j)
C[j, j%N] = 15*cos(j) #+ 8*sin(4.0+arange(N))
C[j, (1 + j)%N] = 15*cos(j) #+ 8*sin(4.0+arange(N))
"""
p = LLSP(C, d)
r = p.solve('lsqr')
print('f_opt: %f' % r.ff) # 2398301.68347
#print 'x_opt:', r.xf
|