Browse Source

fixed tests: glpk had wrong minimize, solver.cpp tested in wrong direction on policy iteration in case we use top. value iteration

Former-commit-id: 71215b8e46
tempestpy_adaptions
sjunges 9 years ago
parent
commit
73310b9881
  1. 4
      src/utility/solver.cpp
  2. 2
      test/functional/solver/GlpkLpSolverTest.cpp

4
src/utility/solver.cpp

@ -87,6 +87,7 @@ namespace storm {
{ {
prefTech = storm::solver::MinMaxTechniqueSelection::FROMSETTINGS; prefTech = storm::solver::MinMaxTechniqueSelection::FROMSETTINGS;
setSolverType(solver); setSolverType(solver);
std::cout << toString(prefTech) << std::endl;
} }
template<typename ValueType> template<typename ValueType>
@ -107,6 +108,7 @@ namespace storm {
template<typename ValueType> template<typename ValueType>
std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> MinMaxLinearEquationSolverFactory<ValueType>::create(storm::storage::SparseMatrix<ValueType> const& matrix, bool trackPolicy) const { std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> MinMaxLinearEquationSolverFactory<ValueType>::create(storm::storage::SparseMatrix<ValueType> const& matrix, bool trackPolicy) const {
std::cout << toString(prefTech) << std::endl;
std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> p1; std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> p1;
switch (solverType) { switch (solverType) {
@ -122,7 +124,7 @@ namespace storm {
} }
case storm::solver::EquationSolverType::Topological: case storm::solver::EquationSolverType::Topological:
{ {
STORM_LOG_THROW(prefTech == storm::solver::MinMaxTechniqueSelection::PolicyIteration, storm::exceptions::NotImplementedException, "Policy iteration for topological solver is not supported.");
STORM_LOG_THROW(prefTech != storm::solver::MinMaxTechniqueSelection::PolicyIteration, storm::exceptions::NotImplementedException, "Policy iteration for topological solver is not supported.");
p1.reset(new storm::solver::TopologicalMinMaxLinearEquationSolver<ValueType>(matrix)); p1.reset(new storm::solver::TopologicalMinMaxLinearEquationSolver<ValueType>(matrix));
break; break;
} }

2
test/functional/solver/GlpkLpSolverTest.cpp

@ -14,7 +14,7 @@
#include "src/solver/OptimizationDirection.h" #include "src/solver/OptimizationDirection.h"
TEST(GlpkLpSolver, LPOptimizeMax) { TEST(GlpkLpSolver, LPOptimizeMax) {
storm::solver::GlpkLpSolver solver(storm::OptimizationDirection::Minimize);
storm::solver::GlpkLpSolver solver(storm::OptimizationDirection::Maximize);
storm::expressions::Variable x; storm::expressions::Variable x;
storm::expressions::Variable y; storm::expressions::Variable y;
storm::expressions::Variable z; storm::expressions::Variable z;

Loading…
Cancel
Save