Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Incorrect algorithm #1
I think this algorithm doesn't work properly. For example, for this data:
F = 300x1 + 250x2 + 450x3 --> max
Returns: [(0, 12.0), (2, 180.0), (4, 60.0)], 23400.0
Also, I've checked some other data. And for this data, it doesn't work at all.
The code indeed does not solve this correctly. I don't yet have a fix.
From what I can see, variable x2 is never pivoted. After inspecting the pivot choices (which are heuristics), I believe the pivot rules are to blame. I previously thought that improving "any" improvable column would work, but this is apparently incorrect. The solution that was reported (but had an indexing bug) was x1 = 60, x2=0, x3 = 12. This is obviously wrong because of the constraint that x2 >= 2.
If I force the code to first pivot on the tableau entry (1,1), then I let it solve to completion as using a better pivot choice heuristic (max of bottom row, min quotient), I get the right output:
Up to rounding error, you can see x3=12.8, x2=2, x1=56.
However, even with the updated pivot selection rule, the first chosen pivot is not (1,1). I will have to think more on this.