Reputation: 1
I am implementing a version of the bin packing problem in cplex and I had to introduce the following constraint, where y and x are boolean decision variables:
forall(i in itens) sum(j in bins) y[i][j] * x[j] == 1;
The problem is that when I run the model cplex give me the following error: "cplex can't extract the expression y[i][j] * x[j].
Does anyone know how to run this properly?
Upvotes: 0
Views: 551
Reputation: 81
I think it should be y[i][j] * x[j] = 1
not y[i][j] * x[j] == 1
Upvotes: 0
Reputation: 10062
if x and y are boolean decision variables, then in order to say
z==x*y
you may write
z<=x; z<=y; z>=x+y-1;
Upvotes: 0