HJReachability / ilqgames

Iterative Linear-Quadratic Games!
https://hjreachability.github.io/ilqgames/
BSD 3-Clause "New" or "Revised" License
132 stars 41 forks source link

Error thrown when no control costs defined #55

Closed rallen10 closed 3 years ago

rallen10 commented 3 years ago

I am working on an example problem where the payoff function only depends on the state of players, there is no cost associated with control input. To the best of my understanding, It seems that such a problem formulation causes an error to be thrown here

https://github.com/HJReachability/ilqgames/blob/f2ce1fc9c3c6e8086a16b483ef551d14789886b5/src/lq_open_loop_solver.cpp#L122

because quad[ii].control is empty

I am trying to understand why this check is enforced? Why must you have a control cost defined? Is there some assumption in the algorithm that control cost must exist or am I misunderstanding the purpose of that check?

There are several workarounds I can think of (e.g. create a trivial control cost that is always zero), but I'd like better understanding of the current implementation before I put together a fix.

dfridovi commented 3 years ago

Good question. That check is there because of a numerical requirement - that is, in the derivation of Nash equilibria for finite horizon LQ games, we require each player to have a control penalty. To get rid of your error, it is possible to add a mild control cost for each player (small positive but nonzero weight). Otherwise, even if you comment out this check you will still get either a runtime QR decomposition error or no runtime error but nonsense nan trajectories... For a full derivation of the finite horizon LQ Nash solution see https://github.com/HJReachability/ilqgames/blob/master/derivations/feedback_lq_nash.pdf

rallen10 commented 3 years ago

Thank you for the explanation. I'll need to spend some more time looking at the derivation to fully understand, but this is sufficient for me to close this issue