How can i add a variable which is a function of some decision variables- parameters to my model?
AnsweredI have a situation which i can not properly added to my model in gurobi python.
I have a decision variable set lets say x[i] for i = 1 to I
and i have a parameter set which is c[i] for i = 1 to I
I want to add my model a new variable which is composed of mentioned 2 above.Lets say;
D[i] = max(0,x[i] - c[i]) for i = 1 to I
I tried to construct D[i] by using addMVars function and than equating it to max(0,x[i] - c[i])
in constraint part yet i am having type error while adding such constraint. How can i add such variable in general which is function of other variables-parameters.
Thanks in advance...
-
Official comment
This post is more than two 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. -
Hi Murat,
Please see this post by Jaromił for an explanation https://support.gurobi.com/hc/en-us/community/posts/4418546803857/comments/4419116068753
- Riley
0
Post is closed for comments.
Comments
2 comments