Skip to content
Snippets Groups Projects
Commit 8991e729 authored by Sebastian Krings's avatar Sebastian Krings
Browse files

catch timeout and report it to prolog

parent 5a40c1f1
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,7 @@ public final class Request { ...@@ -63,6 +63,7 @@ public final class Request {
* have been send to the stream * have been send to the stream
*/ */
public boolean writeNextSolutions(final IPrologTermOutput pto, final int max) { public boolean writeNextSolutions(final IPrologTermOutput pto, final int max) {
try {
boolean solutionsPresent = true; boolean solutionsPresent = true;
int num; int num;
int size = 0; int size = 0;
...@@ -93,10 +94,18 @@ public final class Request { ...@@ -93,10 +94,18 @@ public final class Request {
pto.closeTerm(); pto.closeTerm();
pto.fullstop(); pto.fullstop();
if (logger.isLoggable(Level.FINE)) { if (logger.isLoggable(Level.FINE)) {
logger.fine("wrote " + num + " solutions, computed in " + duration logger.fine("wrote " + num + " solutions, computed in "
+ "ms"); + duration + "ms");
} }
return solutionsPresent; return solutionsPresent;
} catch (RuntimeException ex) {
// timeout of the solver is wrapped in a runtime exception
if ("timed out".equals(ex.getMessage())) {
pto.printAtom("sat_timeout");
return true;
}
throw (ex);
}
} }
private void printInstances(Instance[] solutions, IPrologTermOutput pto) { private void printInstances(Instance[] solutions, IPrologTermOutput pto) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment