From 9859f60db0af7f9d56ca642545fc2ab4539b0365 Mon Sep 17 00:00:00 2001 From: TimQu Date: Wed, 25 Oct 2017 20:27:14 +0200 Subject: [PATCH] Fixed solver tests --- .../storm/solver/GmmxxMinMaxLinearEquationSolverTest.cpp | 4 ++++ .../storm/solver/NativeMinMaxLinearEquationSolverTest.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test/storm/solver/GmmxxMinMaxLinearEquationSolverTest.cpp b/src/test/storm/solver/GmmxxMinMaxLinearEquationSolverTest.cpp index da68456fe..db72b1087 100644 --- a/src/test/storm/solver/GmmxxMinMaxLinearEquationSolverTest.cpp +++ b/src/test/storm/solver/GmmxxMinMaxLinearEquationSolverTest.cpp @@ -19,6 +19,7 @@ TEST(GmmxxMinMaxLinearEquationSolver, SolveWithStandardOptions) { auto factory = storm::solver::GmmxxMinMaxLinearEquationSolverFactory(); auto solver = factory.create(A); + solver->setHasUniqueSolution(); ASSERT_NO_THROW(solver->solveEquations(storm::OptimizationDirection::Minimize, x, b)); ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::getModule().getPrecision()); @@ -42,6 +43,8 @@ TEST(GmmxxMinMaxLinearEquationSolver, SolveWithStandardOptionsAndEarlyTerminatio auto factory = storm::solver::GmmxxMinMaxLinearEquationSolverFactory(); auto solver = factory.create(A); + solver->setLowerBound(0.0); + solver->setUpperBound(1.0); solver->setTerminationCondition(std::make_unique>(storm::storage::BitVector(A.getRowGroupCount(), true), false, bound, true)); ASSERT_NO_THROW(solver->solveEquations(storm::OptimizationDirection::Minimize, x, b)); @@ -111,6 +114,7 @@ TEST(GmmxxMinMaxLinearEquationSolver, SolveWithPolicyIteration) { auto factory = storm::solver::GmmxxMinMaxLinearEquationSolverFactory(storm::solver::MinMaxMethodSelection::PolicyIteration); auto solver = factory.create(A); + solver->setHasUniqueSolution(); ASSERT_NO_THROW(solver->solveEquations(storm::OptimizationDirection::Minimize, x, b)); ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::getModule().getPrecision()); diff --git a/src/test/storm/solver/NativeMinMaxLinearEquationSolverTest.cpp b/src/test/storm/solver/NativeMinMaxLinearEquationSolverTest.cpp index bfd1defcc..bdebc139e 100644 --- a/src/test/storm/solver/NativeMinMaxLinearEquationSolverTest.cpp +++ b/src/test/storm/solver/NativeMinMaxLinearEquationSolverTest.cpp @@ -20,6 +20,7 @@ TEST(NativeMinMaxLinearEquationSolver, SolveWithStandardOptions) { auto factory = storm::solver::NativeMinMaxLinearEquationSolverFactory(); auto solver = factory.create(A); + solver->setHasUniqueSolution(); ASSERT_NO_THROW(solver->solveEquations(storm::OptimizationDirection::Minimize, x, b)); @@ -83,7 +84,9 @@ TEST(NativeMinMaxLinearEquationSolver, SolveWithPolicyIteration) { auto factory = storm::solver::NativeMinMaxLinearEquationSolverFactory(storm::solver::MinMaxMethodSelection::PolicyIteration); auto solver = factory.create(A); - + solver->setLowerBound(0.0); + solver->setUpperBound(1.0); + ASSERT_NO_THROW(solver->solveEquations(storm::OptimizationDirection::Minimize, x, b)); ASSERT_LT(std::abs(x[0] - 0.5), storm::settings::getModule().getPrecision());