I want to enumerate all basic feasible solutions of a linear program. How can I do that with PuLP?
I've read PuLP documentation, but couldn't find out how to do it. Your help would really be appreciated.
I want to enumerate all basic feasible solutions of a linear program. How can I do that with PuLP?
I've read PuLP documentation, but couldn't find out how to do it. Your help would really be appreciated.
You can do this with Pulp, but it is not easy (and of course only works for small problems).
First encode the basis by binary variables. I.e.
b(i) = 1 if x(i) is basic (x(i) are all variables: structural and logical)
0 otherwise
Then add the constraints:
1. if b(i)=0 then x(i)=0 (i.e. if nonbasic then the variable should
be zero -- assuming non-negative variables).
2. sum(i, b(i)) = m (the number of basic variables is equal to
the number of constraints)
Then use this algorithm:
step 1. Solve as a MIP.
If infeasible: STOP
step 2. Add cut to prevent the previous basis
Go to step 1.
The basic algorithm is explained here except there we stop a bit earlier: as soon as the objective deteriorates. That would enumerate all optimal bases.