diff options
Diffstat (limited to 'Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericDrealProblemSolver.java')
-rw-r--r-- | Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericDrealProblemSolver.java | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericDrealProblemSolver.java b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericDrealProblemSolver.java index e0ebcb6b..36ea64aa 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericDrealProblemSolver.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericDrealProblemSolver.java | |||
@@ -43,8 +43,8 @@ public class NumericDrealProblemSolver extends NumericProblemSolver{ | |||
43 | private Map<String, String> curVar2Decl; | 43 | private Map<String, String> curVar2Decl; |
44 | 44 | ||
45 | private final int TIMEOUT_DOCKER = 5000; | 45 | private final int TIMEOUT_DOCKER = 5000; |
46 | private final int TIMEOUT_LOCAL = 10000; | 46 | private final int TIMEOUT_LOCAL = 100000; |
47 | private final boolean DEBUG_PRINT = false; | 47 | private final int DEBUG_PRINT = 3; |
48 | 48 | ||
49 | public NumericDrealProblemSolver(boolean useDocker, String drealLocalPath) throws IOException, InterruptedException { | 49 | public NumericDrealProblemSolver(boolean useDocker, String drealLocalPath) throws IOException, InterruptedException { |
50 | this.useDocker = useDocker; | 50 | this.useDocker = useDocker; |
@@ -87,7 +87,7 @@ public class NumericDrealProblemSolver extends NumericProblemSolver{ | |||
87 | } | 87 | } |
88 | return null; | 88 | return null; |
89 | } | 89 | } |
90 | if (DEBUG_PRINT) { | 90 | if (DEBUG_PRINT > 1) { |
91 | double duration = (double) (System.nanoTime() - startTime) / 1000000000; | 91 | double duration = (double) (System.nanoTime() - startTime) / 1000000000; |
92 | System.out.println("Dur = " + duration + " : "); | 92 | System.out.println("Dur = " + duration + " : "); |
93 | } | 93 | } |
@@ -404,11 +404,13 @@ public class NumericDrealProblemSolver extends NumericProblemSolver{ | |||
404 | System.err.println("TIMEOUT"); | 404 | System.err.println("TIMEOUT"); |
405 | // printOutput(numProbContent); | 405 | // printOutput(numProbContent); |
406 | } | 406 | } |
407 | if (DEBUG_PRINT) { | 407 | if (DEBUG_PRINT > 1) { |
408 | // printOutput(numProbContent); | ||
409 | // if (outputs != null) printOutput(outputs.get(0)); | ||
410 | System.out.println(result); | 408 | System.out.println(result); |
411 | } | 409 | } |
410 | if (DEBUG_PRINT > 2) { | ||
411 | printOutput(numProbContent); | ||
412 | if (outputs != null) printOutput(outputs.get(0)); | ||
413 | } | ||
412 | 414 | ||
413 | return result; | 415 | return result; |
414 | } | 416 | } |
@@ -455,16 +457,30 @@ public class NumericDrealProblemSolver extends NumericProblemSolver{ | |||
455 | Process outputProcess; | 457 | Process outputProcess; |
456 | if (this.useDocker) outputProcess = callDrealDocker(numProbContent, true); | 458 | if (this.useDocker) outputProcess = callDrealDocker(numProbContent, true); |
457 | else outputProcess = callDrealLocal(numProbContent, true); | 459 | else outputProcess = callDrealLocal(numProbContent, true); |
458 | 460 | ||
459 | List<List<String>> outputs = getProcessOutput(outputProcess); | 461 | boolean result = false; |
460 | boolean result = getDrealResult(outputProcess.exitValue(), outputs); | 462 | List<List<String>> outputs = null; |
463 | if (outputProcess != null) { | ||
464 | outputs = getProcessOutput(outputProcess); | ||
465 | result = getDrealResult(outputProcess.exitValue(), outputs); | ||
466 | } | ||
467 | |||
461 | endSolvingProblem = System.nanoTime()-startSolvingProblem; | 468 | endSolvingProblem = System.nanoTime()-startSolvingProblem; |
462 | 469 | ||
463 | if (DEBUG_PRINT) { | 470 | if (outputProcess == null) { |
464 | System.out.println("Getting Solution!"); | 471 | System.err.println("TIMEOUT"); |
465 | // printOutput(numProbContent); | 472 | // printOutput(numProbContent); |
466 | // printOutput(outputs.get(0)); | 473 | } else { |
467 | // System.out.println(result); | 474 | if (DEBUG_PRINT > 0) { |
475 | System.out.println("Getting Solution!"); | ||
476 | } | ||
477 | } | ||
478 | if (DEBUG_PRINT > 1) { | ||
479 | System.out.println(result); | ||
480 | } | ||
481 | if (DEBUG_PRINT > 2) { | ||
482 | printOutput(numProbContent); | ||
483 | if (outputs != null) printOutput(outputs.get(0)); | ||
468 | } | 484 | } |
469 | 485 | ||
470 | //GET SOLUTION | 486 | //GET SOLUTION |
@@ -498,7 +514,7 @@ public class NumericDrealProblemSolver extends NumericProblemSolver{ | |||
498 | endFormingSolution = System.nanoTime() - startFormingSolution; | 514 | endFormingSolution = System.nanoTime() - startFormingSolution; |
499 | } | 515 | } |
500 | else { | 516 | else { |
501 | System.out.println("Unsatisfiable numerical problem"); | 517 | System.out.println("Unsatisfiable numerical problem (trying to get solution...)"); |
502 | } | 518 | } |
503 | return sol; | 519 | return sol; |
504 | } | 520 | } |