snopt / snopt-python

MIT License
42 stars 13 forks source link

o Need assignment of A even if it is not given #2

Closed wtjones1 closed 8 years ago

wtjones1 commented 8 years ago

snopt-python generates a Python error when A is not explicitly given

Traceback (most recent call last): File "/Users/name/Library/Python/2.7/lib/python/site-packages/optimize/snopt7/snopt_solver.py", line 426, in snopta iAfun, jAvar, neA, A, iGfun, jGvar, neG,\ UnboundLocalError: local variable 'A' referenced before assignment

This correction simply assigns "A = None" if A is not given (usrA is not of known type). I hope that it can be applied so that I can delete my fork.

Thanks in advance,

Bill w.t.jones@nasa.gov

slishak commented 8 years ago

I though I'd let you know I coincidentally have been encountering exactly the same problem this week, and just submitted a very similar pull request (I didn't see yours until now though)! My method is slightly different to yours, although I'm not sure which is more valid.

https://github.com/snopt/snopt-python/pull/3