pythonpulp

Python PuLP: Keep variables relative to each other


I want to minimize x1+x2+x3 with PuLP, which works fine already. However the result often consists of one of the three being zero and just the other two ones being used by the algorithm. Is there a way to keep them relative to each other? They all three have the same cost.

For example, instead of PuLP solving the equation with 4+0+5 it should be something like 3+3+3. Is this possible?


Solution

  • Was able to achieve sort of what I wanted by looping the calculation while incrementing a threshhold for the variables:

    x <= threshhold
    y <= threshhold
    z <= threshhold
    

    It means sacrificing some computing power but for my case it isn't really that much more time and serves the job.