0

I've implemented a Branch-and-Cut algorithm using SCIP in C++. My optimization problem has a minimization objective function and currently my code have a bug that I'm struggling to fix it. My problem has an optimal value of 100, but the program returns 101. Looking at the Branch-and-Bound tree (using the visualization tools), I see that SCIP is prunning a node with LP bound 100. Moreover, after some further investigations, I found that indeed, the optimal solution with value 100 should be feasible for this node. I also confirmed that this node is not being prunned by my custom constraint handler. Thus, in order to debug this, I was looking for a way to find out why SCIP prunned this specific node, is there a way of doing this?

I've already tried using the "debug solution" feature, but since I have custom branching rules, it is not working properly. Every time it branches, it reports that my input solution (the optimal one) violates one of the branching inequalities. Moreover, it is not reporting any information on why the problematic node was prunned. Also, when I create the constraint for branching, I set the check flag to FALSE.

Thank you very much for your time and I'd appreciate any comments on this subject.

edit: I'm also locking the variables in my custom constraint handler, so that SCIP will not fix some variables incorrectly.

  • Are your constraints redundant or why did you set `check` to FALSE? If so , did you also set `enforce` to false? I'm assuming `local` is set to TRUE? Can your post the output when the debug solution detects your constraints to violate? – Leon Jul 18 '22 at 08:27
  • Hi Leon, yes, I set "local" to TRUE. I set "check" to FALSE because this was suggested for me in the SCIP mailing list, so that the debug solution is not checked against the branching inequalities. However, I still get reports of the following type: – user1346085 Jul 20 '22 at 14:37
  • ***** debug: row violates debugging solution (lhs=2, rhs=2, activity=[4,4], local=1, lpfeastol=1e-06) branching1: 2 <= +1 + ... +1 <= 2 (I omitted some variables because it was too long.) My branching inequalities say that either the sum is at most 2 or at least 4. In this case, the debug solution violates branching1 but it satisfies branching2. – user1346085 Jul 20 '22 at 14:38
  • Oh, and my constraints are not redundant, but they are used for branching (in my case, in any integer solution, the some of some variables is either 2 or at least 4). The "enforce" flag is also set to FALSE. – user1346085 Jul 20 '22 at 14:49

1 Answers1

0

Ah, I found your question on the mailing list. I looked into the code for checking debug solutions, and I think there is a bug in the way SCIP treats branching constraints wrt to the debug solution (probably because nobody used branching constraints with the debug solution feature). Only the bound changes are checked, not the branching constraints, to determine if the debug solution is relevant for that node. The isSolutionInNode method would need to be extended to also account for node->conssetchg. Unfortunately, that means you cannot use the debug solution feature to hunt down your bug.

Just to make sure, right now your branching inequalities say that the sum is either exactly 2 or at least 4, is this correct? (since you wrote at most 2) Why is this a valid disjunction for the problem you are solving?

If you are completely stuck at this point, but not comfortable enough within SCIP to extend the isSolutionNode yourself I can try to code a patch for you.

Leon
  • 1,588
  • 1
  • 7
  • 16
  • Hi Leon, I see, thanks for the investigation. Indeed I don't know how to patch "isSolutionInNode" in order to support this. My idea would be to (after the parent is checked) check the bound changes only if there is no child of the parent which contains the solution. But this will lead to infinite recursion I guess... I'm sorry, but I would be very glad if you could code this patch (and maybe include it in next SCIP version?). – user1346085 Jul 21 '22 at 13:58
  • For the branching inequalities. I'm solving a vehicle routing problem and I have a variable x_ij for each edge ij. Let S be a set of customers, then x(\delta(S)) = 2 or x(\delta(S)) \geq 4 (the number of edges incident to S cannot be odd). – user1346085 Jul 21 '22 at 13:59
  • Ah, interesting. I will try to find time to code a patch for this. For the modeling part: Have you considered just adding an integer variable y_S for each customer and adding x(\delta(S)) = 2y_S? In that case, normal variable branching on y should propagate to a more general version of your branching rule. – Leon Jul 22 '22 at 07:16
  • Hi, you mean y_S for each subset of vertices S? That would be 2^n variables which would be impractical :/. Thank you very much for the support! – user1346085 Jul 22 '22 at 23:00
  • Ah I thought you could just do it for each customer, my bad – Leon Jul 23 '22 at 11:08