-
Notifications
You must be signed in to change notification settings - Fork 35
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
Getting the value of stage_cost and terminal_cost #41
Comments
Hi @aabsz, unfortunately there's no direct way how to get that value, but what you can do is, since you know how these terms looks like, you can create a function that reproduce them and evaluate these functions at every time step |
As always, thanks for the prompt reply, Bruno. Indeed, I wanted to do that. The issue is, that I only have access to the state variables and control actions at each time step. I lack the information across the prediction horizon, making it impossible to determine the precise value of the cost function at each step. Am I wrong? |
You're right, but there's a way to extract that information (not documented so I can help you with that). Let me prepare a script for you, I'll post it here soon |
@aabsz can you tell me what type of stage and terminal cost do you have? are you using quadratic_stage_cost and quadratic_terminal_cost? |
Hi @aabsz here's a simple example when using quadratic_stage_cost and quadratic_terminal_cost
|
Hello Bruno, Thank you for the script and your time and assistance. I've used all three types of cost functions in my code - stage_cost, quadratic_stage_cost, and quadratic_terminal_cost. I'll attempt to implement the generic stage cost using your script too. Given the complexity of my NMPC framework with various variable parameters, I'm uncertain about its direct applicability to my case. I'll do my best to test it, although my time is limited as I'm currently working on a paper due tomorrow. |
Hi,
Would you please let me know how I can get the value of stage_cost and terminal_cost at each time step of the simulation?
The text was updated successfully, but these errors were encountered: