Recursive objective function modelling
回答済みHello, I developed a optimization model with Gurobi, but I cannot figure out how to set the recursive objective function as shown in the picture.
Then an error happended like this:

Could you have solutions for this problem?
Thank you in advance!
0
-
正式なコメント
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
You are calling your function with \(\texttt{s[k]}\) in the recursion, but it should be just \(\texttt{s}\).
def Q_func(k,s):
if k == 0:
return 0
else:
return Q_func(k-1,s) + u[k] - s[k]Best regards,
Jaromił0 -
Ok, thank you! I've solved it.
0
投稿コメントは受け付けていません。
コメント
3件のコメント