Browse Source
Made DD-based model construction work for all DTMC benchmarks we have. Included tests for both DD-based and excplicit model generation from PRISM models.
Made DD-based model construction work for all DTMC benchmarks we have. Included tests for both DD-based and excplicit model generation from PRISM models.
Former-commit-id: e4af6d9f8a
tempestpy_adaptions
dehnert
10 years ago
4 changed files with 162 additions and 59 deletions
-
70src/builder/DdPrismModelBuilder.cpp
-
82src/builder/DdPrismModelBuilder.h
-
36test/functional/builder/DdPrismModelBuilderTest.cpp
-
33test/functional/builder/ExplicitPrismModelBuilderTest.cpp
@ -0,0 +1,36 @@ |
|||
#include "gtest/gtest.h"
|
|||
#include "storm-config.h"
|
|||
|
|||
#include <utility>
|
|||
|
|||
#include "src/storage/dd/CuddDd.h"
|
|||
#include "src/parser/PrismParser.h"
|
|||
#include "src/builder/DdPrismModelBuilder.h"
|
|||
|
|||
TEST(DdPrismModelBuilderTest, Dtmc) { |
|||
storm::prism::Program program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/die.pm"); |
|||
|
|||
std::pair<storm::dd::Dd<storm::dd::DdType::CUDD>, storm::dd::Dd<storm::dd::DdType::CUDD>> model = storm::builder::DdPrismModelBuilder<storm::dd::DdType::CUDD>::translateProgram(program); |
|||
EXPECT_EQ(13, model.first.getNonZeroCount()); |
|||
EXPECT_EQ(20, model.second.getNonZeroCount()); |
|||
|
|||
program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/brp-16-2.pm"); |
|||
model = storm::builder::DdPrismModelBuilder<storm::dd::DdType::CUDD>::translateProgram(program); |
|||
EXPECT_EQ(677, model.first.getNonZeroCount()); |
|||
EXPECT_EQ(867, model.second.getNonZeroCount()); |
|||
|
|||
program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/crowds-5-5.pm"); |
|||
model = storm::builder::DdPrismModelBuilder<storm::dd::DdType::CUDD>::translateProgram(program); |
|||
EXPECT_EQ(8607, model.first.getNonZeroCount()); |
|||
EXPECT_EQ(15113, model.second.getNonZeroCount()); |
|||
|
|||
program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/leader-3-5.pm"); |
|||
model = storm::builder::DdPrismModelBuilder<storm::dd::DdType::CUDD>::translateProgram(program); |
|||
EXPECT_EQ(273, model.first.getNonZeroCount()); |
|||
EXPECT_EQ(397, model.second.getNonZeroCount()); |
|||
|
|||
program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/nand-5-2.pm"); |
|||
model = storm::builder::DdPrismModelBuilder<storm::dd::DdType::CUDD>::translateProgram(program); |
|||
EXPECT_EQ(1728, model.first.getNonZeroCount()); |
|||
EXPECT_EQ(2505, model.second.getNonZeroCount()); |
|||
} |
@ -0,0 +1,33 @@ |
|||
#include "gtest/gtest.h"
|
|||
#include "storm-config.h"
|
|||
|
|||
#include "src/parser/PrismParser.h"
|
|||
#include "src/builder/ExplicitPrismModelBuilder.h"
|
|||
|
|||
TEST(ExplicitPrismModelBuilderTest, Dtmc) { |
|||
storm::prism::Program program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/die.pm"); |
|||
|
|||
std::unique_ptr<storm::models::AbstractModel<double>> model = storm::builder::ExplicitPrismModelBuilder<double>::translateProgram(program); |
|||
EXPECT_EQ(13, model->getNumberOfStates()); |
|||
EXPECT_EQ(20, model->getNumberOfTransitions()); |
|||
|
|||
program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/brp-16-2.pm"); |
|||
model = storm::builder::ExplicitPrismModelBuilder<double>::translateProgram(program); |
|||
EXPECT_EQ(677, model->getNumberOfStates()); |
|||
EXPECT_EQ(867, model->getNumberOfTransitions()); |
|||
|
|||
program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/crowds-5-5.pm"); |
|||
model = storm::builder::ExplicitPrismModelBuilder<double>::translateProgram(program); |
|||
EXPECT_EQ(8607, model->getNumberOfStates()); |
|||
EXPECT_EQ(15113, model->getNumberOfTransitions()); |
|||
|
|||
program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/leader-3-5.pm"); |
|||
model = storm::builder::ExplicitPrismModelBuilder<double>::translateProgram(program); |
|||
EXPECT_EQ(273, model->getNumberOfStates()); |
|||
EXPECT_EQ(397, model->getNumberOfTransitions()); |
|||
|
|||
program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/nand-5-2.pm"); |
|||
model = storm::builder::ExplicitPrismModelBuilder<double>::translateProgram(program); |
|||
EXPECT_EQ(1728, model->getNumberOfStates()); |
|||
EXPECT_EQ(2505, model->getNumberOfTransitions()); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue