diff options
author | 2019-07-24 10:59:02 +0200 | |
---|---|---|
committer | 2019-07-24 10:59:02 +0200 | |
commit | 64138e8d91bc8d7bb54d9b042f872b43550dec16 (patch) | |
tree | 73c9574a26b83eac91cd0bdb18f2c61b6b212871 /Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/PolyhedronSolverTest.xtend | |
parent | Implement Coin-OR CBC polyhedron saturation operator (diff) | |
download | VIATRA-Generator-64138e8d91bc8d7bb54d9b042f872b43550dec16.tar.gz VIATRA-Generator-64138e8d91bc8d7bb54d9b042f872b43550dec16.tar.zst VIATRA-Generator-64138e8d91bc8d7bb54d9b042f872b43550dec16.zip |
Cardinality propagator WIP
Diffstat (limited to 'Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/PolyhedronSolverTest.xtend')
-rw-r--r-- | Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/PolyhedronSolverTest.xtend | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/PolyhedronSolverTest.xtend b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/PolyhedronSolverTest.xtend index 789018cb..15758985 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/PolyhedronSolverTest.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.tests/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/tests/cardinality/PolyhedronSolverTest.xtend | |||
@@ -17,7 +17,7 @@ abstract class PolyhedronSolverTest { | |||
17 | var PolyhedronSaturationOperator operator | 17 | var PolyhedronSaturationOperator operator |
18 | 18 | ||
19 | protected def PolyhedronSolver createSolver() | 19 | protected def PolyhedronSolver createSolver() |
20 | 20 | ||
21 | @Before | 21 | @Before |
22 | def void setUp() { | 22 | def void setUp() { |
23 | solver = createSolver() | 23 | solver = createSolver() |
@@ -183,7 +183,7 @@ abstract class PolyhedronSolverTest { | |||
183 | 183 | ||
184 | assertEquals(PolyhedronSaturationResult.EMPTY, result) | 184 | assertEquals(PolyhedronSaturationResult.EMPTY, result) |
185 | } | 185 | } |
186 | 186 | ||
187 | @Test | 187 | @Test |
188 | def void unboundedRelaxationWithNoIntegerSolutionTest() { | 188 | def void unboundedRelaxationWithNoIntegerSolutionTest() { |
189 | val x = new Dimension("x", 0, 1) | 189 | val x = new Dimension("x", 0, 1) |
@@ -193,7 +193,29 @@ abstract class PolyhedronSolverTest { | |||
193 | #[new LinearConstraint(#{x -> 2}, 1, 1)], | 193 | #[new LinearConstraint(#{x -> 2}, 1, 1)], |
194 | #[x, y] | 194 | #[x, y] |
195 | )) | 195 | )) |
196 | 196 | ||
197 | val result = saturate() | ||
198 | |||
199 | assertEquals(PolyhedronSaturationResult.EMPTY, result) | ||
200 | } | ||
201 | |||
202 | @Test | ||
203 | def void emptyConstraintTest() { | ||
204 | val constraint = new LinearConstraint(emptyMap, 0, 1) | ||
205 | createSaturationOperator(new Polyhedron(#[], #[constraint], #[constraint])) | ||
206 | |||
207 | val result = saturate() | ||
208 | |||
209 | assertEquals(PolyhedronSaturationResult.SATURATED, result) | ||
210 | assertEquals(0, constraint.lowerBound) | ||
211 | assertEquals(0, constraint.upperBound) | ||
212 | } | ||
213 | |||
214 | @Test | ||
215 | def void emptyConstraintUnsatisfiableTest() { | ||
216 | val constraint = new LinearConstraint(emptyMap, 1, 0) | ||
217 | createSaturationOperator(new Polyhedron(#[], #[constraint], #[constraint])) | ||
218 | |||
197 | val result = saturate() | 219 | val result = saturate() |
198 | 220 | ||
199 | assertEquals(PolyhedronSaturationResult.EMPTY, result) | 221 | assertEquals(PolyhedronSaturationResult.EMPTY, result) |