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.

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
Please sign in to leave a comment.
Comments
1 comment