I have a group of integer variables in matrix X, that should all have the same value. Let I be their respective indices. The way I approach this, is to create a new unconstrained integer variable temp and make every value of X equal to temp.
X(I) == temp;
. I suspect that this is probably the most inefficient way to do this, but I have not found any keyword that could imply this. I have the feeling that somehow the nice structure of the problem does not get taken into consideration with my formulation.
Any suggestions? Is there a better way to approach this?
PS:Another effort was to create a diagonal matrix out of X(I) and multiply it with an all ones matrix, demanding equality to an all temp value matrix, but of course this is absolutely the same and didn’t improve my running time at all.