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

KeyError in Mix Integer Path Planning #41

Closed
carlosluis opened this issue Mar 5, 2018 · 12 comments
Closed

KeyError in Mix Integer Path Planning #41

carlosluis opened this issue Mar 5, 2018 · 12 comments

Comments

@carlosluis
Copy link

carlosluis commented Mar 5, 2018

Hi @AtsushiSakai , I'm interested in modifying your Mix Integer Path Planning to a multi-vehicle scenario, however I'm having troubles running your code. This is the console output when I run the code:

mix_integer_opt_path_planning.py start!!
('time:', 0)
Academic license - for non-commercial use only
Traceback (most recent call last):
File "mix_integer_opt_path_planning.py", line 127, in
main()
File "mix_integer_opt_path_planning.py", line 101, in main
s_p, u_p = control(s, gs, ob)
File "mix_integer_opt_path_planning.py", line 69, in control
prob.solve(solver=cvxpy.GUROBI)
File "/usr/local/lib/python2.7/dist-packages/cvxpy-0.4.11-py2.7.egg/cvxpy/problems/problem.py", line 209, in solve
return self._solve(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/cvxpy-0.4.11-py2.7.egg/cvxpy/problems/problem.py", line 331, in _solve
kwargs)
File "/usr/local/lib/python2.7/dist-packages/cvxpy-0.4.11-py2.7.egg/cvxpy/problems/solvers/gurobi_intf.py", line 229, in solve
A, b)
File "/usr/local/lib/python2.7/dist-packages/cvxpy-0.4.11-py2.7.egg/cvxpy/problems/solvers/gurobi_intf.py", line 326, in add_model_lin_constr
expr_list[i].append((c, v))
KeyError: 206

It has something to do with the use of the GUROBI solver, however I verified it is correctly installed already (I ran one of the examples they provide). Do you have an idea of what could be wrong? Thanks!

@AtsushiSakai
Copy link
Owner

Hi. @carlosluisg. Thank you for your interest about my repo.
I have no idea about it actually... However, you should use Python 3.6. It seems you are using 2.7.
I hope your problem will be solved if you upgrade your python.

@carlosluis
Copy link
Author

I tried that, installing cvxpy in Python 3. However I'm getting an error saying cvxpy has no attribute Bool now

@AtsushiSakai
Copy link
Owner

@carlosluisg Could you paste the new error msg?

@carlosluis
Copy link
Author

Sure, here it is:

mix_integer_opt_path_planning.py start!!
time: 0
Traceback (most recent call last):
File "mix_integer_opt_path_planning.py", line 127, in
main()
File "mix_integer_opt_path_planning.py", line 101, in main
s_p, u_p = control(s, gs, ob)
File "mix_integer_opt_path_planning.py", line 39, in control
o = cvxpy.Bool(4 * nob, T)
AttributeError: module 'cvxpy' has no attribute 'Bool'

Once again, thanks for the support

@AtsushiSakai
Copy link
Owner

Which versions of cvxpy are you using?

@carlosluis
Copy link
Author

1.0.0

@AtsushiSakai
Copy link
Owner

Oh, I'm using 0.4. Can you downgrade it? or it takes time to fix the problem..

@carlosluis
Copy link
Author

carlosluis commented Mar 6, 2018

I downgraded but now the problem seems to be that gurobi does not support Python 3.5 in Linux, what is your current OS?

@AtsushiSakai
Copy link
Owner

I'm using Mac (High sierra). Why you are using Python 3.5? I think cvxpy 0.4 supports Python 3.6.

@carlosluis
Copy link
Author

Yes, I just realized that. I'm upgrading now and will get back to you with the results. Hopefully it will work

@carlosluis
Copy link
Author

carlosluis commented Mar 6, 2018

The problem Persists with Python3.6 and cvxpy 0.4. Output as proof:

time: 0
Academic license - for non-commercial use only
Traceback (most recent call last):
File "mix_integer_opt_path_planning.py", line 127, in
main()
File "mix_integer_opt_path_planning.py", line 101, in main
s_p, u_p = control(s, gs, ob)
File "mix_integer_opt_path_planning.py", line 69, in control
prob.solve(solver=cvxpy.GUROBI)
File "/usr/local/lib/python3.6/dist-packages/cvxpy-0.4.11-py3.6.egg/cvxpy/problems/problem.py", line 209, in solve
return self._solve(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/cvxpy-0.4.11-py3.6.egg/cvxpy/problems/problem.py", line 331, in _solve
kwargs)
File "/usr/local/lib/python3.6/dist-packages/cvxpy-0.4.11-py3.6.egg/cvxpy/problems/solvers/gurobi_intf.py", line 229, in solve
A, b)
File "/usr/local/lib/python3.6/dist-packages/cvxpy-0.4.11-py3.6.egg/cvxpy/problems/solvers/gurobi_intf.py", line 326, in add_model_lin_constr
expr_list[i].append((c, v))
KeyError: 240

I'm running Ubuntu 16.04, maybe there's a bug linux related, since it works for you on OSX. Could you check your version of gurobi? I'm using gurobipy-7.5.2

@AtsushiSakai
Copy link
Owner

I'm using gurobipy-7.5.2... It's same.

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

2 participants