0

In an optimization problem developed in PuLP i use the following objective function:

objective = p.lpSum(vec[r] for r in range(0,len(vec)))

All variables are non-negative integers, hence the sum over the vector gives the total number of units for my problem. Now i am struggling with the fact, that PuLP only gives one of many solutions and i would like to narrow down the solution space to results that favors the solution set with the smallest standard deviation of the decision variables. E.g. say vec is a vector with elements 6 and 12. Then 7/11, 8/10, 9/9 are equally feasible solutions and i would like PuLP to arrive at 9/9. Then the objective

objective = p.lpSum(vec[r]*vec[r] for r in range(0,len(vec)))

would obviously create a cost function, that would help the case, but alas, it is non-linear and PuLP throws an error. Anyone who can point me to a potential solution?

1 Answers1

0

Instead of minimizing the standard deviation (which is inherently non-linear), you could minimize the range or bandwidth. Along the lines of:

 minimize maxv-minv
 maxv >= vec[r]   for all r
 minv <= vec[r]   for all r
Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39
  • Good thought! In reality, vec has ~1000 entries, and among those will be elements in groups with stronger and weaker interaction. Those "groups" contain two or more elements and can of course not be distinguished by any simple means. An example with groups of 2 for simplicity: E.g. vec is currently (6,12,...,30,40,....1,3), but for the diamond solution i would hope for (9,9,...,35,35,...,2,2). Your suggestion might help for a part of it. I'll try this. – Steppenwolf May 24 '22 at 14:13