|
@ -25,7 +25,7 @@ std::shared_ptr<storm::models::sparse::Model<double>> buildExampleModel() { |
|
|
TEST(KSPTest, dijkstra) { |
|
|
TEST(KSPTest, dijkstra) { |
|
|
auto model = buildExampleModel(); |
|
|
auto model = buildExampleModel(); |
|
|
|
|
|
|
|
|
storm::storage::sparse::state_type testState = 300; |
|
|
|
|
|
|
|
|
storm::utility::ksp::state_t testState = 300; |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
|
|
|
|
|
|
double dist = spg.getDistance(1); |
|
|
double dist = spg.getDistance(1); |
|
@ -35,7 +35,7 @@ TEST(KSPTest, dijkstra) { |
|
|
TEST(KSPTest, singleTarget) { |
|
|
TEST(KSPTest, singleTarget) { |
|
|
auto model = buildExampleModel(); |
|
|
auto model = buildExampleModel(); |
|
|
|
|
|
|
|
|
storm::storage::sparse::state_type testState = 300; |
|
|
|
|
|
|
|
|
storm::utility::ksp::state_t testState = 300; |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
|
|
|
|
|
|
double dist = spg.getDistance(100); |
|
|
double dist = spg.getDistance(100); |
|
@ -45,7 +45,7 @@ TEST(KSPTest, singleTarget) { |
|
|
TEST(KSPTest, reentry) { |
|
|
TEST(KSPTest, reentry) { |
|
|
auto model = buildExampleModel(); |
|
|
auto model = buildExampleModel(); |
|
|
|
|
|
|
|
|
storm::storage::sparse::state_type testState = 300; |
|
|
|
|
|
|
|
|
storm::utility::ksp::state_t testState = 300; |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
|
|
|
|
|
|
double dist = spg.getDistance(100); |
|
|
double dist = spg.getDistance(100); |
|
@ -59,7 +59,7 @@ TEST(KSPTest, reentry) { |
|
|
TEST(KSPTest, groupTarget) { |
|
|
TEST(KSPTest, groupTarget) { |
|
|
auto model = buildExampleModel(); |
|
|
auto model = buildExampleModel(); |
|
|
|
|
|
|
|
|
auto groupTarget = storm::utility::ksp::state_list_t{50, 90}; |
|
|
|
|
|
|
|
|
auto groupTarget = std::vector<storm::utility::ksp::state_t>{50, 90}; |
|
|
auto spg = storm::utility::ksp::ShortestPathsGenerator<double>(model, groupTarget); |
|
|
auto spg = storm::utility::ksp::ShortestPathsGenerator<double>(model, groupTarget); |
|
|
|
|
|
|
|
|
// this path should lead to 90
|
|
|
// this path should lead to 90
|
|
@ -78,7 +78,7 @@ TEST(KSPTest, groupTarget) { |
|
|
TEST(KSPTest, kTooLargeException) { |
|
|
TEST(KSPTest, kTooLargeException) { |
|
|
auto model = buildExampleModel(); |
|
|
auto model = buildExampleModel(); |
|
|
|
|
|
|
|
|
storm::storage::sparse::state_type testState = 1; |
|
|
|
|
|
|
|
|
storm::utility::ksp::state_t testState = 1; |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
|
|
|
|
|
|
ASSERT_THROW(spg.getDistance(2), std::invalid_argument); |
|
|
ASSERT_THROW(spg.getDistance(2), std::invalid_argument); |
|
@ -87,11 +87,11 @@ TEST(KSPTest, kTooLargeException) { |
|
|
TEST(KSPTest, kspStateSet) { |
|
|
TEST(KSPTest, kspStateSet) { |
|
|
auto model = buildExampleModel(); |
|
|
auto model = buildExampleModel(); |
|
|
|
|
|
|
|
|
storm::storage::sparse::state_type testState = 300; |
|
|
|
|
|
|
|
|
storm::utility::ksp::state_t testState = 300; |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
|
|
|
|
|
|
storm::storage::BitVector referenceBV(model->getNumberOfStates(), false); |
|
|
storm::storage::BitVector referenceBV(model->getNumberOfStates(), false); |
|
|
for (auto s : storm::utility::ksp::state_list_t{300, 293, 285, 279, 271, 265, 259, 252, 244, 237, 229, 223, 217, 210, 202, 195, 187, 181, 175, 168, 160, 153, 145, 139, 133, 126, 118, 111, 103, 97, 91, 84, 76, 69, 61, 55, 49, 43, 35, 41, 32, 25, 19, 14, 10, 7, 4, 2, 1, 0}) { |
|
|
|
|
|
|
|
|
for (auto s : std::vector<storm::utility::ksp::state_t>{300, 293, 285, 279, 271, 265, 259, 252, 244, 237, 229, 223, 217, 210, 202, 195, 187, 181, 175, 168, 160, 153, 145, 139, 133, 126, 118, 111, 103, 97, 91, 84, 76, 69, 61, 55, 49, 43, 35, 41, 32, 25, 19, 14, 10, 7, 4, 2, 1, 0}) { |
|
|
referenceBV.set(s, true); |
|
|
referenceBV.set(s, true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -103,11 +103,11 @@ TEST(KSPTest, kspStateSet) { |
|
|
TEST(KSPTest, kspPathAsList) { |
|
|
TEST(KSPTest, kspPathAsList) { |
|
|
auto model = buildExampleModel(); |
|
|
auto model = buildExampleModel(); |
|
|
|
|
|
|
|
|
storm::storage::sparse::state_type testState = 300; |
|
|
|
|
|
|
|
|
storm::utility::ksp::state_t testState = 300; |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
storm::utility::ksp::ShortestPathsGenerator<double> spg(model, testState); |
|
|
|
|
|
|
|
|
// TODO: use path that actually has a loop or something to make this more interesting
|
|
|
// TODO: use path that actually has a loop or something to make this more interesting
|
|
|
auto reference = storm::utility::ksp::state_list_t{300, 293, 285, 279, 271, 265, 259, 252, 244, 237, 229, 223, 217, 210, 202, 195, 187, 181, 175, 168, 160, 153, 145, 139, 133, 126, 118, 111, 103, 97, 91, 84, 76, 69, 61, 55, 49, 43, 35, 41, 32, 25, 19, 14, 10, 7, 4, 2, 1, 0}; |
|
|
|
|
|
|
|
|
auto reference = std::vector<storm::utility::ksp::state_t>{300, 293, 285, 279, 271, 265, 259, 252, 244, 237, 229, 223, 217, 210, 202, 195, 187, 181, 175, 168, 160, 153, 145, 139, 133, 126, 118, 111, 103, 97, 91, 84, 76, 69, 61, 55, 49, 43, 35, 41, 32, 25, 19, 14, 10, 7, 4, 2, 1, 0}; |
|
|
auto list = spg.getPathAsList(7); |
|
|
auto list = spg.getPathAsList(7); |
|
|
|
|
|
|
|
|
EXPECT_EQ(list, reference); |
|
|
EXPECT_EQ(list, reference); |
|
|