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
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
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
Post is closed for comments.
Comments
3 comments