You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Optimal control results should include the final cost achieved #694
The the optimal control module (ct.optimal), it would be useful if the functions that compute an optimal trajectory returned the cost associated with the final trajectory that is returned, so that it doesn't have to be recomputed. (Perhaps also a function to compute the cost along a curve according to an arbitrary cost function.)
The return object from ct.optimal.solve_ocp is a OptimizeResult object, so result.fun will get you the value of the function. Whoever handles this enhancement should change that to be something more meaningful (eg, result.cost as a property that maps to result.fun).
Activity
ThomasGiavasopoulos commentedon Mar 2, 2022
Is there currently an option to return the value of the cost associated with a final trajectory given a time horizon?
murrayrm commentedon Mar 3, 2022
The return object from
ct.optimal.solve_ocpis a OptimizeResult object, soresult.funwill get you the value of the function. Whoever handles this enhancement should change that to be something more meaningful (eg,result.costas a property that maps toresult.fun).murrayrm commentedon Mar 18, 2022
FYI, I have added this to an upcoming PR.
ThomasGiavasopoulos commentedon Mar 19, 2022
That sounds really useful. Hope that it gets added soon!