1

I'm getting TypeErrors when trying to run the optimization library pyOpt. The code I'm trying to run is the basic example given here (I'm only testing for the SLSQP solver).

I'm getting the following error during the execution of the solver

la = numpy.array([max(m,1)], numpy.int) gg = numpy.zeros([la], numpy.float) TypeError: only integer scalar arrays can be converted to a scalar index

I suspect the error is due to changes in numpy because of the answer given here. If that is the case, what are my options to make the library work? I can think of downgrading numpy but I don't want any unforseen changes to the other libraries in my system.

Using Python 2.7 with numpy 1.12.1 on Ubuntu 14.04.

1 Answer 1

1

replace lz with lz[0] - the issue is with version of numpy as you noted.

/usr/local/lib/python2.7/dist-packages/pyOpt/pySLSQP/pySLSQP.py

I got it to run by changing lines

374     gg = numpy.zeros([la[0]], numpy.float)
377     dg = numpy.zeros([la[0],n+1], numpy.float)
401     w = numpy.zeros([lw[0]], numpy.float)
404     jw = numpy.zeros([ljw[0]], numpy.intc)

I ended up encountering errors during execution that were not python errors but rather errors encountered during operation of the compiled code, so I just switched to using pyGMO2 and I am satisfied.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.