Changeset 423
 Timestamp:
 02/05/10 18:08:20 (1 month ago)
 Files:

 PythonPackages/OpenOpt/openopt/examples/llsp_1.py (modified) (2 diffs)
Legend:
 Unmodified
 Added
 Removed
 Modified
 Copied
 Moved

PythonPackages/OpenOpt/openopt/examples/llsp_1.py
r184 r423 4 4 from openopt import LLSP 5 5 6 M, N = 3, 26 M, N = 1500, 1000 7 7 C = empty((M,N)) 8 8 d = empty(M) … … 11 11 d[j] = 1.5*N+80*sin(j) 12 12 C[j] = 8*sin(4.0+arange(N)) + 15*cos(j) 13 14 """ alternatvely, try the sparse problem  lsqr solver can take benefits of it: 15 for j in xrange(M): 16 d[j] = 1.5*N+80*sin(j) 17 C[j, j%N] = 15*cos(j) #+ 8*sin(4.0+arange(N)) 18 C[j, (1 + j)%N] = 15*cos(j) #+ 8*sin(4.0+arange(N)) 19 """ 13 20 14 21 p = LLSP(C, d) 15 r = p.solve('lapack_dgelss') #requires scipy installed 16 # or using singleprecision: 17 #r = p.solve('lapack_sgelss') 22 r = p.solve('lsqr') 18 23 19 #using llsp2nlp converter with an NLP solver: 20 #r = p.solve('nlp:scipy_cg') 21 22 print 'f_opt:', r.ff # 611.600991401 24 print 'f_opt:', r.ff # 2398301.68347 23 25 #print 'x_opt:', r.xf 24 26