Topic: Item Not Found Error

I am getting a long error message concluding with (AttributeError: item not found) when I try to add optimize over oovars that were constructed in a loop when I use an fd.exp function (it does not seem to happen with fd.sum or fd.log) .  This is a new problem that I noticed after upgrading to .32 (my code ran fine on earlier versions). 
Here is some code that demonstrates the problem (ignore the quality of the optimization problem, I just wanted to make a quick example to show the issue). 

import FuncDesigner as fd
import numpy as np
from openopt import NLP,oosolver

n = 100

a = fd.oovar('a')

logitIncVal = np.zeros(n)

mkVecAll = np.ones(n)
mkVecAll[0:(n-50)] = -.9
mkVecAll[(n-50):(n-30)] = .11

mkVec = np.unique(mkVecAll)

expMkVecAll = fd.exp(mkVecAll*a)
for mk in mkVec:
    selMk = (mkVecAll == mk)
    logitIncVal += ((expMkVecAll*selMk).sum())*selMk

startVal = {a:1}

prob = NLP(logitIncVal.sum(), startVal, show=False,goal='max',maxIter = 400)
res = prob.solve('ralg',start=True)

Thanks for your help!
(I use the software for estimating economic models as part of my graduate student work).

Last edited by tedcr20 (2010-12-19 04:43:45)

Re: Item Not Found Error

I think I have committed the bugfix, you should try now.
Unfortunately, Trac failed (I don't know the reason yet), so if you use Win OS you should install a win svn client.
Or just replace the line 762 in FuncDesigner/ by
                        rr = (t1 if isscalar(t1) or prod(t1.shape)>1 else asscalar(t1) if type(t1)==ndarray else t1[0, 0]) \
                        * (val if isscalar(val) or prod(val.shape)>1 else asscalar(val) if type(val)==ndarray else val[0, 0])
Regards, D.

Re: Item Not Found Error

That worked!
Thanks very much and happy New Year.