<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p>Dear Scip community,</p>
<p><br>
</p>
<p>I am doing branch-price-and-cut, so I add both variables and cutting planes dynamically.</p>
<p>Cutting planes are added by calling SCIPcreateEmptyRowSepa(), and then adding the relevant row by calling SCIPaddRow().<br>
</p>
<p>The variables are added as follows. Note that the variables are also allowed to be deleted by SCIP, which occasionally happens.<br>
</p>
<pre style="background-color:#2b2b2b; color:#a9b7c6; font-family:'JetBrains Mono',monospace; font-size:9.8pt"><span style="color:#908b25">SCIP_CALL</span>(SCIPaddPricedVar(scip<span style="color:#cc7832">,</span>variable.<span style="color:#9373a5">variable</span><span style="color:#cc7832">,</span>pricing_value))<span style="color:#cc7832">;<br></span><span style="color:#908b25">SCIP_CALL</span>(SCIPcreateVar(scip<span style="color:#cc7832">,</span>&variable.<span style="color:#9373a5">variable</span><span style="color:#cc7832">, </span>name.c_str()<span style="color:#cc7832">,</span><span style="color:#6897bb">0.0</span><span style="color:#cc7832">,</span><span style="color:#6897bb">1.0</span><span style="color:#cc7832">,</span><span style="color:#6897bb">1.0</span><span style="color:#cc7832">,</span><span style="color:#9876aa; font-style:italic">SCIP_VARTYPE_BINARY</span><span style="color:#cc7832">,<br></span><span style="color:#cc7832">                        </span>initial<span style="color:#cc7832">,</span>TRUE<span style="color:#cc7832">,</span>NULL<span style="color:#cc7832">,</span>NULL<span style="color:#cc7832">,</span>NULL<span style="color:#cc7832">,</span>NULL<span style="color:#cc7832">,</span>(<span style="color:#b9bcd1">SCIP_VARDATA </span>*)(index)))<span style="color:#cc7832">;<br></span>SCIPvarMarkDeletable(variable.<span style="color:#9373a5">variable</span>)<span style="color:#cc7832">;<br></span><span style="color:#908b25">SCIP_CALL</span>(SCIPaddPricedVar(scip<span style="color:#cc7832">,</span>variable.<span style="color:#9373a5">variable</span><span style="color:#cc7832">,</span>pricing_value))<span style="color:#cc7832">;</span></pre>
After that, I add the variables to the relevant cutting plane rows using:
<pre style="background-color:#2b2b2b; color:#a9b7c6; font-family:'JetBrains Mono',monospace; font-size:9.8pt"><span style="color:#908b25">SCIP_CALL</span>(SCIPaddVarToRow(scip<span style="color:#cc7832">,</span>cutting_plane.<span style="color:#9373a5">row</span><span style="color:#cc7832">,</span>variable.<span style="color:#9373a5">variable</span><span style="color:#cc7832">,</span>coefficient))<span style="color:#cc7832">; </span></pre>
<p>I also catch variable deletion events in order to update my local storage (e.g. make sure that I do not access deleted variables)<br>
</p>
<pre style="background-color:#2b2b2b; color:#a9b7c6; font-family:'JetBrains Mono',monospace; font-size:9.8pt"><span style="color:#908b25">SCIP_CALL</span>(SCIPcatchVarEvent(scip<span style="color:#cc7832">,</span>variable.<span style="color:#9373a5">variable</span><span style="color:#cc7832">,</span>SCIP_EVENTTYPE_VARDELETED<span style="color:#cc7832">,</span>SCIPfindEventhdlr(scip<span style="color:#cc7832">,</span><span style="color:#b5b6e3">VarDeletedEventHandler</span>::name().c_str())<span style="color:#cc7832">,</span>NULL<span style="color:#cc7832">,</span>NULL))<span style="color:#cc7832">;<br></span></pre>
<p>I get the following error. It is reproduciable: (e.g. consistent every time).</p>
<p><span><br>
</span></p>
<p><span>....../scipoptsuite-8.0.0/scip/src/scip/lp.c:1189: rowSearchCoefPart: Assertion `row->cols_index[pos] == row->cols[pos]->index' failed.</span></p>
<p><br>
</p>
<p>Relevant stack trace: (SCIP 8.0, compiled in debug)<br>
</p>
</div>
<div dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<pre>__GI_raise 0x00007f3e9cd7918b
__GI_abort 0x00007f3e9cd58859
__assert_fail_base 0x00007f3e9cd58729
__GI___assert_fail 0x00007f3e9cd69f36
rowSearchCoefPart lp.c:1189
rowSearchCoef lp.c:1238
SCIProwIncCoef lp.c:5542
SCIPvarAddToRow var.c:14319
SCIPaddVarToRow scip_lp.c:1695<br>-------------------------------<br>user pricing code<br>-------------------------------
pricerRedcostObj objpricer.cpp:182
SCIPpricerRedcost pricer.c:410
SCIPpricerExec pricer.c:494
SCIPpriceLoop solve.c:2114
priceAndCutLoop solve.c:2374
solveNodeLP solve.c:3080
propAndSolve solve.c:3886
solveNode solve.c:4186
SCIPsolveCIP solve.c:4982
SCIPsolve scip_solve.c:2745
SCIPdialogExecOptimize dialog_default.c:2183
SCIPdialogExec dialog.c:942
SCIPdialoghdlrExec dialog.c:393
SCIPstartInteraction scip_dialog.c:243
SCIPprocessShellArguments scipshell.c:479
runSCIP main.cpp:29
main main.cpp:45
__libc_start_main 0x00007f3e9cd5a0b3
_start 0x000055f8d93b876e
</pre>
<br>
<p></p>
<p></p>
<p><br>
</p>
<p>The problem seems to persist in both SCIP 7.3 and 8.0. <br>
</p>
<p>For different instances scip sometimes crashes at other points internally, but this is always at some assertion for row or column indicing. If this is helpful, I could also provide these stacktraces/errors. When compiling in release, I simply get an internal
 segfault within SCIP.<br>
</p>
<p><br>
</p>
<p></p>
<p>The problem disappears if I either:</p>
<div>
<ol style="margin-bottom:0px; margin-top:0px">
<li>Do not mark the variables as deletable (e.g. they are not deleted)</li><li>Do not generate any cutting plane rows (but do delete variables from the original problem constraints).</li></ol>
<div><br>
</div>
<div>So my suspicion is that something goes wrong in SCIP's internal storage when variables are deleted.<br>
</div>
</div>
<p>I am confused, because the documentation on the website (<a href="https://scipopt.org/doc/html/FAQ.php#howtodeletevariables" class="OWAAutoLink" id="LPlnk967395" previewremoved="true">https://scipopt.org/doc/html/FAQ.php#howtodeletevariables</a>) mentions
 that for linear constraints SCIP handles deletion automatically (and it does so fine for my fixed set covering constraints). Do I need to manually delete variables from cut rows in the variable deletion callback, or should this be done by SCIP and is this
 simply a bug?<br>
<br>
Best,<br>
<br>
Rolf<br>
</p>
<p><br>
</p>
</div>
</div>
</body>
</html>