7

When I tried to use Java to call CPLEX and use callback functions to solve a VRP problem with branch-and-cut, some problems emerged.

I took out the subtour elimination constraint from the original problem, and used it as usercut and lazyconstraint. When I only used it as a lazyconstraint, the algorithm worked out very well, but when I used it as both usercut and lazyconstraint Java program couldn't stop, it kept calling usercutCallback at node0 and wouldn't make branch. I really don't know what the problem is.

Does CPLEX loop calling usercutCallback at each non-integer node until no usercut are violated, and then make branch? If so, can I set the maximum number of calls at each node? Maybe just one time is ok.

Another problem is why it kept generating the same cut. I think when cut A has been already added, even if I generate A again in the next loop, it should have been satisfied so that no usercut is violated and the loop should be stopped.

xin koala
  • 79
  • 1
  • May I ask whether you figure out how to resolve the problem? I have exactly the same problem? – Sam Mar 16 '21 at 16:47

1 Answers1

5

This question was also asked and answered on a CPLEX forum and on my blog.

Update: The gist of the answer is that when you add a cut in a callback, CPLEX updates the node solution to reflect that cut and then invokes the callback again (still at the same node) to see if you have more cuts to add. To let CPLEX move on to another node, your callback needs to exit without adding another cut. In particular, if you add the same cut each time the callback is invoked at the same node, you will create an indefinite loop.

prubin
  • 39,078
  • 3
  • 37
  • 104