diff options
Diffstat (limited to 'Framework/hu.bme.mit.inf.dslreasoner.viatra2logic')
-rw-r--r-- | Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericDrealProblemSolver.java | 7 |
1 files changed, 6 insertions, 1 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 36ea64aa..d7e0b20c 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 | |||
@@ -8,6 +8,7 @@ import java.io.IOException; | |||
8 | import java.io.InputStream; | 8 | import java.io.InputStream; |
9 | import java.io.InputStreamReader; | 9 | import java.io.InputStreamReader; |
10 | import java.io.PrintWriter; | 10 | import java.io.PrintWriter; |
11 | import java.text.DecimalFormat; | ||
11 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
12 | import java.util.Arrays; | 13 | import java.util.Arrays; |
13 | import java.util.HashMap; | 14 | import java.util.HashMap; |
@@ -504,7 +505,9 @@ public class NumericDrealProblemSolver extends NumericProblemSolver{ | |||
504 | if (obj instanceof IntegerElement) { | 505 | if (obj instanceof IntegerElement) { |
505 | sol.put(obj, Integer.parseInt(value)); | 506 | sol.put(obj, Integer.parseInt(value)); |
506 | } else { | 507 | } else { |
507 | sol.put(obj, Double.parseDouble(value)); | 508 | double fullVal = Double.parseDouble(value); |
509 | double trimmed = Math.round(fullVal * 1000.0) / 1000.0; | ||
510 | sol.put(obj, trimmed); | ||
508 | } | 511 | } |
509 | } | 512 | } |
510 | } else { | 513 | } else { |
@@ -515,6 +518,8 @@ public class NumericDrealProblemSolver extends NumericProblemSolver{ | |||
515 | } | 518 | } |
516 | else { | 519 | else { |
517 | System.out.println("Unsatisfiable numerical problem (trying to get solution...)"); | 520 | System.out.println("Unsatisfiable numerical problem (trying to get solution...)"); |
521 | //null means no soln found | ||
522 | return null; | ||
518 | } | 523 | } |
519 | return sol; | 524 | return sol; |
520 | } | 525 | } |