HiGHS icon indicating copy to clipboard operation
HiGHS copied to clipboard

HPresolveAnalysis.cpp:103: void HPresolveAnalysis::startPresolveRuleLog(const HighsInt): Assertion `num_deleted_rows0_ == *numDeletedRows' failed

Open ambros-gleixner opened this issue 2 years ago • 22 comments

Building

  • SCIP from branch https://github.com/scipopt/scip/tree/lpi-highs
  • with the latest branch of HiGHS (debug build) and running the unit test ctest -R glbconss in SCIP yields the above assert. When I turn on debug_print I get:
...
[lp.c:10346] debug: solving LP 160 (43 cols, 56 rows) with primal simplex (diving=0, nprimallps=15, ndivinglps=0)
Presolving model
   startPresolveRuleLog [     0,      0] for ( 2) Redundant row
   startPresolveRuleLog [     1,      0] for ( 2) Redundant row
   startPresolveRuleLog [     2,      0] for ( 5) Dominated col
   startPresolveRuleLog [     2,      1] for ( 5) Dominated col
   startPresolveRuleLog [     2,      2] for ( 5) Dominated col
   startPresolveRuleLog [     2,      3] for ( 5) Dominated col
   startPresolveRuleLog [     2,      4] for ( 5) Dominated col
   startPresolveRuleLog [     2,      5] for ( 7) Forcing col
53 rows, 37 cols, 135 nonzeros
   startPresolveRuleLog [     3,      6] for ( 2) Redundant row
   startPresolveRuleLog [     4,      6] for ( 2) Redundant row
   startPresolveRuleLog [     5,      6] for ( 7) Forcing col
   startPresolveRuleLog [     6,      7] for ( 7) Forcing col
   startPresolveRuleLog [     7,      8] for ( 7) Forcing col
   startPresolveRuleLog [     8,      9] for ( 7) Forcing col
   startPresolveRuleLog [    11,     11] for (12) Aggregator
ERROR: Model : 9 = num_deleted_rows0_ != *numDeletedRows = 11 ||10 = num_deleted_cols0_ != *numDeletedCols = 11
boxfort-worker: /home/bzfgleix/research/HiGHS/src/presolve/HPresolveAnalysis.cpp:103: void HPresolveAnalysis::startPresolveRuleLog(const HighsInt): Assertion `num_deleted_rows0_ == *numDeletedRows' failed.

Any idea why this is happening? It sounds a bit like a logging error, not an actual incorrect reduction.

ambros-gleixner avatar Feb 01 '23 17:02 ambros-gleixner

It's a logging error

jajhall avatar Feb 01 '23 17:02 jajhall

Okay, but can we reopen this and fix it? It would be good to reach a clean run where HiGHS does not throw any asserts.

ambros-gleixner avatar Feb 02 '23 00:02 ambros-gleixner

I think that the problem is because it's a MIP. I wasn't expecting users to turn on debug_print, but I can force the presolve logging to be off for MIPs. It's been useful for some student studies on presolve for LPs

jajhall avatar Feb 02 '23 12:02 jajhall

It is not a MIP, the problem is a pure LP. We don't pass any integer information to HiGHS.

And the assert also fails without debug_print, I only turned it on to give you more information.

ambros-gleixner avatar Feb 02 '23 13:02 ambros-gleixner

It is not a MIP, the problem is a pure LP. We don't pass any integer information to HiGHS.

Sorry, of course

It shouldn't be doing the presolve logging by default.

jajhall avatar Feb 02 '23 13:02 jajhall

So, presolve_rule_logging is now off by default (in fix-1124 - soon to be in latest)

Since presolve_rule_logging used to be on by default, I'm surprised this assert wasn't triggered for us. This suggests that it's something to do with free rows - since we never have them in MIP subproblems, and they are removed when reading from an MPS file.

jajhall avatar Feb 02 '23 14:02 jajhall

Fix now in latest

jajhall avatar Feb 02 '23 14:02 jajhall

Thanks a lot! I can confirm that the problem disappears with latest latest.

ambros-gleixner avatar Feb 02 '23 15:02 ambros-gleixner

I tried ctest -R glbconss, but No tests were found!!!

How is this unit test run?

jajhall avatar Feb 03 '23 10:02 jajhall

This is the right command, you have to execute it in your build folder, not in the main SCIP folder. Does that resolve the problem?

ambros-gleixner avatar Feb 03 '23 18:02 ambros-gleixner

I didn't have a build folder.

I've just created one off /home/jajhall/scip (where I had been running cmake and make) and ran

cmake .. -DPAPILO=off -DLPS=highs -DHIGHS_DIR=/home/jajhall/HiGHS/build -DCMAKE_BUILD_TYPE=Debug -DREADLINE=off -DGMP=off -DZIMPL=off -DIPOPT=off

but nothing is created, and I see Build files have been written to: /home/jajhall/scip

In /home/jajhall/scip/Makefile, I have

CMAKE_SOURCE_DIR = /home/jajhall/scip

jajhall avatar Feb 03 '23 18:02 jajhall

So

cd /home/jajhall/scip
mkdir build
cd build
cmake .. # add your options
make
ctest

does not work? Also not after a fresh clone?

See also https://scipopt.org/doc/html/md_INSTALL.php#CMAKE

ambros-gleixner avatar Feb 03 '23 21:02 ambros-gleixner

Still doesn't work after a fresh clone. Could it be that my options are stopping the test from being created?

cmake .. -DPAPILO=off -DLPS=highs -DHIGHS_DIR=/home/jajhall/HiGHS/build -DCMAKE_BUILD_TYPE=Debug -DREADLINE=off -DGMP=off -DZIMPL=off -DIPOPT=off

jajhall avatar Feb 04 '23 12:02 jajhall

Yes, good guess. It is not your build options, but probably an optional dependency for executing the unit tests. You need to install https://github.com/Snaipe/Criterion first in order to run this test. Your cmake output should show you that Criterion has been found, then the ctest -R glbcons should work, too.

ambros-gleixner avatar Feb 04 '23 23:02 ambros-gleixner

Thanks, but building Criterion from source fails, and I don't know where to install their binaries

jajhall avatar Feb 06 '23 09:02 jajhall

The README says there are packages for Ubuntu and other distributions, so apt-get install ... should work.

ambros-gleixner avatar Feb 06 '23 10:02 ambros-gleixner

apt-get install libcriterion-dev E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

Looks pretty flaky software to me

jajhall avatar Feb 06 '23 10:02 jajhall

I guess you need sudo apt-get install ... to have the permissions, nothing about criterion.

ambros-gleixner avatar Feb 06 '23 11:02 ambros-gleixner

Of course!

jajhall avatar Feb 06 '23 11:02 jajhall

I've reproduced the issue

jajhall avatar Feb 06 '23 14:02 jajhall

However, I can't get meaningful output, or open the test in VScode. The log is LastTestsFailed.log

The associated executable, that use in VScode is /home/jajhall/scip/tests/cons/nonlinear/unittest-cons-nonlinear-glbconss, but (consistent with the .logfile) the failure seems to be in Criterion.

jajhall avatar Feb 06 '23 14:02 jajhall

Yes, these unit tests are sometimes a bit painful to debug, because criterion catches asserts. If you just need more output, I created the log by a temporary patch, something like

diff --git a/src/lpi/lpi_highs.cpp b/src/lpi/lpi_highs.cpp
index b35ca748e6..293e93f787 100644
--- a/src/lpi/lpi_highs.cpp
+++ b/src/lpi/lpi_highs.cpp
@@ -658,6 +658,7 @@ SCIP_RETCODE SCIPlpiCreate(
 #ifdef HIGHS_DEBUG
    HIGHS_CALL( (*lpi)->highs->setOptionValue("highs_debug_level", 2) );
 #endif
+   HIGHS_CALL( (*lpi)->highs->setOptionValue("log_dev_level", kHighsLogDevLevelVerbose) );

    /* set default scaling */
    SCIP_CALL( SCIPlpiSetIntpar(*lpi, SCIP_LPPAR_SCALING, 1) );
diff --git a/tests/src/cons/nonlinear/glbconss.c b/tests/src/cons/nonlinear/glbconss.c
index da110ee2b6..b8fc1756fe 100644
--- a/tests/src/cons/nonlinear/glbconss.c
+++ b/tests/src/cons/nonlinear/glbconss.c
@@ -676,6 +676,7 @@ static
 void setup(void)
 {
    SCIP_CALL( SCIPcreate(&scip) );
+   SCIP_CALL( SCIPsetBoolParam(scip, "display/lpinfo", TRUE) );

    /* include default plugins */
    SCIP_CALL( SCIPincludeDefaultPlugins(scip) );``` 

ambros-gleixner avatar Feb 06 '23 22:02 ambros-gleixner