Skip to main content
3 votes

Turning K-Medoids into an optimization problem

Yes, the problem can be solved exactly using common IP algorithms such as branch-and-cut, with the usual qualification that there will be some limit on the size of the problems you can handle. (What ...
prubin's user avatar
  • 40.1k
3 votes

Grouping values based on a difference constraint

Since you've a threshold (diff) you may pre-define max of diff number of groups, not the full length of the list. As for the if condition try this $L(x_{i,g}+x_{j,g}-1) \le d - (L_j - L_i)$ where $L$ ...
Sutanu Majumdar's user avatar
3 votes

Grouping values based on a difference constraint

Some of this may be solver dependent. I just ran your model with only one change -- switching the solver from glpk to CPLEX -- and got a valid solution (the same as yours, changing group 10 to group 2)...
prubin's user avatar
  • 40.1k
1 vote

Turning K-Medoids into an optimization problem

sure, K-medoids could be expressed as an optimization problem, I recommend you read the paper: Clustering by a means of medoids, Leonard kaufman, peter rousseeuw
Jair Ramos's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible