1#include "storm-config.h"
20 while (offset < targetNumberOfBits) {
21 auto const name =
"v" + std::to_string(index++);
30 uint64_t
const width = rng() % 9;
31 info.
locationVariables.emplace_back(
manager.declareIntegerVariable(name), (uint64_t(1) << width) - 1, offset, width,
true);
37 uint64_t
const width = 1 + rng() % 52;
38 int64_t
const lowerBound =
static_cast<int64_t
>(rng() % 20) - 10;
40 lowerBound +
static_cast<int64_t
>((uint64_t(1) << width) - 1), offset, width);
52 for (uint64_t i = 0;
i < numberOfBits; ++
i) {
53 state.set(i, rng() % 2 == 0);
60 for (uint64_t i = 0;
i < numberOfFlips; ++
i) {
61 uint64_t
const bit = rng() % state.
size();
62 state.
set(bit, !state.
get(bit));
70 EXPECT_EQ(expected.asInt(v.variable.getExpression()), actual.asInt(v.variable.getExpression())) << v.variable.getName();
73 EXPECT_EQ(expected.asBool(v.variable.getExpression()), actual.asBool(v.variable.getExpression())) << v.variable.getName();
76 EXPECT_EQ(expected.asInt(v.variable.getExpression()), actual.asInt(v.variable.getExpression())) << v.variable.getName();
82TEST(CompressedStateTest, UnpackStateDifferenceIntoEvaluator) {
83 std::mt19937_64 rng(1234);
85 for (uint64_t targetBits : {10ul, 64ul, 100ul, 300ul, 1200ul}) {
86 for (
int layoutIteration = 0; layoutIteration < 20; ++layoutIteration) {
87 auto manager = std::make_shared<storm::expressions::ExpressionManager>();
88 auto const info = createRandomLayout(*manager, rng, targetBits);
95 for (
int step = 0; step < 30; ++step) {
102 next = perturbState(current, rng, 1);
105 next = perturbState(current, rng, 5);
113 expectSameValues(info, fullyUnpacked, incremental);
114 if (::testing::Test::HasFailure()) {
TEST(CompressedStateTest, UnpackStateDifferenceIntoEvaluator)
This class is responsible for managing a set of typed variables and all expressions using these varia...
void set(uint64_t index, bool value=true)
Sets the given truth value at the given index.
size_t size() const
Retrieves the number of bits this bit vector can store.
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
template void unpackStateIntoEvaluator< double >(CompressedState const &state, VariableInformation const &variableInformation, storm::expressions::ExpressionEvaluator< double > &evaluator)
template void unpackStateDifferenceIntoEvaluator< double >(CompressedState const &newState, CompressedState const &oldState, VariableInformation const &variableInformation, storm::expressions::ExpressionEvaluator< double > &evaluator)
storm::storage::BitVector CompressedState
SettingsManager const & manager()
Retrieves the settings manager.