clustering and SOS constraints
AnsweredConsider 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?
Thanks.
0
-
It depends.
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.
Best regards,
Jaromił0 -
Each point must end up exactly in 1 cluster. Equality constraint it is then.
Thank you!
Dudley
0
Please sign in to leave a comment.
Comments
2 comments