It seems to me that you have two problems:
- You probably need a way to model your “minimize variety” (i.e., “maximize the number of rows, whose values are all equal to 0”) objective function that is not the “proxy” you used (by minimizing the number of used pieces). Unless an exact solution is not really needed, and this heuristic objective function is enough for you. If you want to really model the “variety minimization” exactly you should probably create an extra variable for each item type, and use indicator constraints to set these variables to one if any knapsack use the correspondent item type. Then the sum of this variable set will be the number of different piece types used in all knapsack solutions.
- You need to decide how to merge the two distinct objective functions you have (“variety minimization” and “amount of pieces used minimization”). I think you have two main possibilities. The first is to create a merged objective function with both objective functions there, each one multiplied by a hand-chosen weight of “how much this objective function is important in relation to the other”. And then with your intuition about what “a good solution looks like” and multiple tests you find what are the optimal weights for you, finally formalizing the problem. Alternatively, you look at the multi-objective facilities of recent solvers but I am not sure JuMP supports it yet. Maybe you would need use the low-level interface and lock into a specific solver to use this feature.