Hello,
I'm taking a linear programming course, and I'm attempting to write an
efficient frontier problem based on the code in
http://www.orfe.princeton.edu/~rvdb/307/lectures/lec3.pdf
With verbose on, I get an error:
Traceback (most recent call last):
File "project2.py", line 68, in <module>
sum(dev[t] for t in T) / float(n) <= risk
File "C:\Python25\Lib\site-packages\pymprog.py", line 76, in st
return prob.st(cons, name, inds)
File "C:\Python25\Lib\site-packages\pymprog.py", line 246, in st
if me.verb: cons.exprint()
AttributeError: 'constraint' object has no attribute 'exprint'
The line that causes it is
c1 = st(
sum(dev[t] for t in T) / float(n) <= risk
)
Where the relevant code is
dates = [] # Time entries
for data in portfolio:
if (data[2] not in dates):
dates.append(data[2])
A[data[0]].append(data[1])
n = len(dates)
T = range(1, n)
dev = var(T, 'T') # Dictionary with keys in T
risk = 0.08
I can run the basic.py example, though. Any help?
-Alex
|