clustering and SOS constraintsAnswered
Consider a clustering problem; grouping N points into K clusters:
x = m.addVars(N, K, vtype=GRB.BINARY)
Should I use this constraint
m.addConstrs((x.sum(i, '*') == 1 for i in range(N)))
or the SOS1 constraint?
Do you want that each point is in exactly 1 cluster? Then go for the equality constraint.
Do you want that each point is in at most 1 cluster? Then go for the SOS1 constraint.
Each point must end up exactly in 1 cluster. Equality constraint it is then.
Please sign in to leave a comment.