I am trying to implement Benders Decomposition to a Mixed Integer Linear Program using the python API that CPLEX exposes. The tutorial file (bendersatsp.py) that comes with it shows how we can implement "ray" cuts, when the inner sub-problem is unbounded. It however, does not illustrate the procedure to implement point cuts. Paul Robin's blog on the JAVA API mentions that "When the LP subproblem is feasible, we can get the dual values directly with a function named getDuals". Is the procedure same in case of python? Is there an example that shows how to do this?
Also, why would the sample code that comes with cplex not do this? In such cases, what happens when the inner problem is feasible?
bendersatsp.py
is for structured problem as far as I remember. If I understand you correctly you need to find an optimality cut (there are two kinds of cuts in Benders' for LP: feasibility and optimality cuts) since you need to find duals (for LP relaxation of your MIP). With Python API:
subproblem = cplex.Cplex()
## construct your subproblems
.....
## find variables' names:
con_names = subproblem.linear_constraints.get_names()
subproblem.solve()
## get the duals to cunstruct the cut:
duals = subproblem.solution.get_dual_values(con_names)
One more thing, get_dual_values()
returns either dual extreme points or rays depending on the solution status of your problem (though the name of the method is a bit vague).