Decision Variables that are not in the objective function
Hello everyone,
I'm writing a model where I must use variables that are not defined in the objective function but only in the constraint set. For instance, my objective function is in the Figure below:
In the constraint set, I have a constraint, for example, that take usage of a variable x_{ij}^{c}, which are not in the objective function. This particular constraint is described below:
At first, I thought that I don't need to do anything besides use the x[i][j][c] = model.addVar(); method. But It seems that the x_{ij}^{c} does not make any difference in the model after all, and then I added the variable with a 0 coefficient to the objective function in order to investigate if any difference comes out, but I was not successful.
So how do I use variables that are defined only in the constraint set?
Best regards.
-
Official comment
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 why not try our AI Gurobot?. -
Hi Jose,
Defining variables without an objective coefficient is standard use. Maybe you are declaring your constraints wrong? Did you inspect the resulting model through the LP file?
Daniel
0
Post is closed for comments.
Comments
2 comments