Browse Source

A few minor fixes. Removed test for reward model.

tempestpy_adaptions
dehnert 12 years ago
parent
commit
0f9f5e67f6
  1. 4
      src/models/Mdp.h
  2. 8
      src/parser/NondeterministicSparseTransitionParser.cpp
  3. 23
      test/reward/RewardModelTest.cpp

4
src/models/Mdp.h

@ -89,7 +89,9 @@ private:
for (uint_fast64_t row = 0; row < this->getTransitionMatrix()->getRowCount(); row++) {
T sum = this->getTransitionMatrix()->getRowSum(row);
if (sum == 0) continue;
if (std::abs(sum - 1) > precision) return false;
if (std::abs(sum - 1) > precision) {
return false;
}
}
return true;
}

8
src/parser/NondeterministicSparseTransitionParser.cpp

@ -136,7 +136,9 @@ uint_fast64_t NondeterministicSparseTransitionParser::firstPass(char* buf, uint_
// is followed by a space. We need to skip over that space first (instead of trimming whitespaces),
// before we can skip to the line end, because trimming the white spaces will proceed to the next line
// in case there is no action label in the fourth column.
++buf;
if (buf[0] == ' ') {
++buf;
}
/*
* Proceed to beginning of next line.
@ -285,7 +287,9 @@ NondeterministicSparseTransitionParser::NondeterministicSparseTransitionParser(s
/*
* Proceed to beginning of next line in file and next row in matrix.
*/
++buf;
if (buf[0] == ' ') {
++buf;
}
buf += strcspn(buf, " \t\n\r");
buf = trimWhitespaces(buf);
}

23
test/reward/RewardModelTest.cpp

@ -1,23 +0,0 @@
#include "gtest/gtest.h"
#include "Eigen/Sparse"
#include "src/exceptions/InvalidArgumentException.h"
#include "boost/integer/integer_mask.hpp"
#include <vector>
#include "reward/RewardModel.h"
TEST(RewardModelTest, ReadWriteTest) {
// 50 entries
storm::reward::RewardModel<std::vector, double> rm(50, 0.0);
double values[50];
for (int i = 0; i < 50; ++i) {
values[i] = 1.0 + i;
ASSERT_TRUE(rm.setReward(i, values[i]));
ASSERT_EQ(rm.getReward(i), values[i]);
}
}
Loading…
Cancel
Save