potassco / clasp

⚙️ A conflict-driven nogood learning answer set solver

Home Page:https://potassco.org/clasp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User Statistics are only printed if the statistics are "accessed".

rkaminsk opened this issue · comments

Just calling ClaspFacade::addStatisticsCallback is not enough to make user statistics appear in the text output. When the (read-only) statistics are traversed at some point, then they will appear also in the textoutput with --stats.

One way to fix this could be

diff --git a/src/clasp_facade.cpp b/src/clasp_facade.cpp
index c99ed7d..f07cea2 100644
--- a/src/clasp_facade.cpp
+++ b/src/clasp_facade.cpp
@@ -637,6 +637,7 @@ void ClaspFacade::Statistics::initLevel(uint32 level) {
        }
 }
 void ClaspFacade::Statistics::addExternal(StatsCallback cb, void* data) {
+       getClingo();
        sources_.push_back(UserSource(cb, data));
 }

Here it would probably be better to store the sources in the ClingoView in the first place.

Thanks. Fixed in dev.