Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ipopt test doesn't pass--too many arguments to nlp.solve. #7

Open
rockg opened this issue Dec 20, 2013 · 8 comments
Open

Ipopt test doesn't pass--too many arguments to nlp.solve. #7

rockg opened this issue Dec 20, 2013 · 8 comments

Comments

@rockg
Copy link

rockg commented Dec 20, 2013

I'm trying to use the Ipopt solver but am wondering if you made local changes to your pyipopt package. Specifically, solve only takes two arguments, x0 and userdata. What version of pyipopt and Ipopt are you using?

In ipopt_solver.m:

x, zl, zu, obj, status, zg = nlp.solve(x0, m, userdata)

Thank you for your great work on this port.

@rwl
Copy link
Owner

rwl commented Dec 20, 2013

I have push up an old version that I think I must have used:

https://github.com/rwl/pyipopt

However, it seems that PyIPOPT has received a considerable amount of attention since I last looked at it:

https://github.com/xuy/pyipopt

I will leave this issue open until PYPOWER has been updated to use that branch. Ultimately, platform specific eggs should be available here:

https://pypi.python.org/pypi/pyipopt

@rockg
Copy link
Author

rockg commented Dec 20, 2013

Running the latest pyipopt with Ipopt 3.11.1 and removing the 2nd argument (m) now results in a segmentation fault in Ipopt running the t_opf_ipopt.py test. It's not clear where the issue is (pypower, pyipopt, ipopt)...lots of moving parts. I will try your uploaded pyipopt to see if that changes things (obviously you got it working at one point).

@rockg
Copy link
Author

rockg commented Dec 20, 2013

Unfortunately, I still get errors using rwl/pyipopt (in fact it segfaults when creating the problem) which would suggest some api change in Ipopt that I have versus the version that pyipopt works with.

@rwl
Copy link
Owner

rwl commented Dec 20, 2013

I just remembered that I wrote this guide for setting up external solvers:

https://github.com/rwl/PYPOWER/blob/master/doc/solvers.rst

It looks like I was using Ipopt 3.9.3.

@rockg
Copy link
Author

rockg commented Dec 21, 2013

I tried this from scratch at home using the Ipopt 3.11.5 and pyipopt from the current github master and was able to run the optimization part successfully by simply just removing the (m) argument and the modifying the output arguments (zg is moved). So clearly the segfaults are something on my end.

@kennyvinente
Copy link

I don't know if any user still have this problem.. but if so, i found a solution for this problem: change the output of eval_jac_g and eval_h functions when flag=True to: return ((Js.row).astype(int), (Js.col).astype(int)) and return ((Hs.row).astype(int), (Hs.col).astype(int)), respectively. Apparentely without this the solver returns a segmentation fault.

@daetzm
Copy link

daetzm commented Apr 16, 2019

Hi kennyvinente, how did you solve the original problem:
x, zl, zu, obj, status, zg = nlp.solve(x0, m, userdata) (TypeError: function takes at most 2 arguments (3 given))
Did you also remove the m? I tried removing the m but then zg is an integer and not an array. This results in my script crashing here:
muSf[il] = 2 * info['lmbda'][2 * nb + arange(nl2)] * branch[il, RATE_A] / baseMVA (TypeError: 'int' object has no attribute 'getitem')
I am using ipopt version 3.12.7

@kennyvinente
Copy link

Hello @daetzm .. some changes that i performed was:
x, zl, zu, zg, obj, status, = nlp.solve(x0, userdata) (there is a change in the outputs, probably because of the ipopt version). Also, i'm using ipopt version 3.12.12 and python3.6
And most important.. check the return of all functions, specially the eval_g and eval_h functions..check if they are running correctly.. for example, try with a 3bus system (easy to analise).

the seg fault problem is because this functions are not returning the results appropriately, so i did those changes and now its fine..

here is an image with ipopt running an opf problem

Captura de tela de 2019-04-16 09-30-43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants