Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
AbstractionInformation.cpp
Go to the documentation of this file.
2
6
9
12
13namespace storm::gbar {
14namespace abstraction {
15
16template<storm::dd::DdType DdType>
18 std::set<storm::expressions::Variable> const& abstractedVariables,
19 std::unique_ptr<storm::solver::SmtSolver>&& smtSolver, AbstractionInformationOptions const& options)
21 equivalenceChecker(std::move(smtSolver)),
23 constraints(options.constraints),
24 ddManager(std::make_shared<storm::dd::DdManager<DdType>>(env)),
26 allLocationIdentities(ddManager->getBddOne()),
28 // Intentionally left empty.
29}
30
31template<storm::dd::DdType DdType>
35
36template<storm::dd::DdType DdType>
41
42template<storm::dd::DdType DdType>
46
47template<storm::dd::DdType DdType>
49 // Check if we already have an equivalent predicate.
50 for (uint64_t index = 0; index < predicates.size(); ++index) {
51 auto const& oldPredicate = predicates[index];
52 if (equivalenceChecker.areEquivalent(oldPredicate, predicate)) {
53 expressionToBddMap[predicate] = expressionToBddMap.at(oldPredicate);
54 return index;
55 }
56 }
57
58 std::size_t predicateIndex = predicates.size();
59 predicateToIndexMap[predicate] = predicateIndex;
60
61 // Add the new predicate to the list of known predicates.
62 predicates.push_back(predicate);
63
64 // Add DD variables for the new predicate.
65 std::stringstream stream;
66 stream << predicate;
67 std::pair<storm::expressions::Variable, storm::expressions::Variable> newMetaVariable = ddManager->addMetaVariable(stream.str());
68
69 predicateDdVariables.push_back(newMetaVariable);
70 extendedPredicateDdVariables.push_back(newMetaVariable);
71 predicateBdds.emplace_back(ddManager->getEncoding(newMetaVariable.first, 1), ddManager->getEncoding(newMetaVariable.second, 1));
72 predicateIdentities.push_back(ddManager->getEncoding(newMetaVariable.first, 1).iff(ddManager->getEncoding(newMetaVariable.second, 1)));
74 sourceVariables.insert(newMetaVariable.first);
75 successorVariables.insert(newMetaVariable.second);
76 sourcePredicateVariables.insert(newMetaVariable.first);
77 successorPredicateVariables.insert(newMetaVariable.second);
78 orderedSourcePredicateVariables.push_back(newMetaVariable.first);
79 orderedSuccessorPredicateVariables.push_back(newMetaVariable.second);
80 ddVariableIndexToPredicateIndexMap[predicateIdentities.back().getIndex()] = predicateIndex;
81 expressionToBddMap[predicate] = predicateBdds[predicateIndex].first && !bottomStateBdds.first;
82
83 return predicateIndex;
84}
85
86template<storm::dd::DdType DdType>
87std::vector<uint_fast64_t> AbstractionInformation<DdType>::addPredicates(std::vector<storm::expressions::Expression> const& predicates) {
88 std::vector<uint_fast64_t> predicateIndices;
89 for (auto const& predicate : predicates) {
90 predicateIndices.push_back(this->getOrAddPredicate(predicate));
91 }
92 return predicateIndices;
93}
94
95template<storm::dd::DdType DdType>
96std::vector<storm::expressions::Expression> const& AbstractionInformation<DdType>::getConstraints() const {
97 return constraints;
98}
99
100template<storm::dd::DdType DdType>
104
105template<storm::dd::DdType DdType>
109
110template<storm::dd::DdType DdType>
114
115template<storm::dd::DdType DdType>
119
120template<storm::dd::DdType DdType>
121std::shared_ptr<storm::dd::DdManager<DdType>> AbstractionInformation<DdType>::getDdManagerAsSharedPointer() {
122 return ddManager;
123}
124
125template<storm::dd::DdType DdType>
126std::shared_ptr<storm::dd::DdManager<DdType> const> AbstractionInformation<DdType>::getDdManagerAsSharedPointer() const {
127 return ddManager;
128}
129
130template<storm::dd::DdType DdType>
131std::vector<storm::expressions::Expression> const& AbstractionInformation<DdType>::getPredicates() const {
132 return predicates;
133}
134
135template<storm::dd::DdType DdType>
136std::vector<storm::expressions::Expression> AbstractionInformation<DdType>::getPredicates(storm::storage::BitVector const& predicateValuation) const {
137 STORM_LOG_ASSERT(predicateValuation.size() == this->getNumberOfPredicates(), "Size of predicate valuation does not match number of predicates.");
138
139 std::vector<storm::expressions::Expression> result;
140 for (uint64_t index = 0; index < this->getNumberOfPredicates(); ++index) {
141 if (predicateValuation[index]) {
142 result.push_back(this->getPredicateByIndex(index));
143 } else {
144 result.push_back(!this->getPredicateByIndex(index));
145 }
146 }
147
148 return result;
149}
150
151template<storm::dd::DdType DdType>
152std::vector<storm::expressions::Expression> AbstractionInformation<DdType>::getPredicatesExcludingBottom(
153 storm::storage::BitVector const& predicateValuation) const {
154 uint64_t offset = 1 + this->getNumberOfDdSourceLocationVariables();
155 STORM_LOG_ASSERT(predicateValuation.size() == this->getNumberOfPredicates() + offset, "Size of predicate valuation does not match number of predicates.");
156
157 std::vector<storm::expressions::Expression> result;
158 for (uint64_t index = 0; index < this->getNumberOfPredicates(); ++index) {
159 if (predicateValuation[index + offset]) {
160 result.push_back(this->getPredicateByIndex(index));
161 } else {
162 result.push_back(!this->getPredicateByIndex(index));
163 }
164 }
165
166 return result;
167}
168
169template<storm::dd::DdType DdType>
173
174template<storm::dd::DdType DdType>
176 auto indexIt = predicateToIndexMap.find(predicate);
177 STORM_LOG_THROW(indexIt != predicateToIndexMap.end(), storm::exceptions::InvalidOperationException, "Cannot retrieve BDD for unknown predicate.");
178 return predicateBdds[indexIt->second].first;
179}
180
181template<storm::dd::DdType DdType>
185
186template<storm::dd::DdType DdType>
188 return predicates.size();
189}
190
191template<storm::dd::DdType DdType>
192std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getAbstractedVariables() const {
193 return abstractedVariables;
194}
195
196template<storm::dd::DdType DdType>
197void AbstractionInformation<DdType>::createEncodingVariables(uint64_t player1VariableCount, uint64_t player2VariableCount, uint64_t auxVariableCount) {
198 STORM_LOG_THROW(player1Variables.empty() && player2Variables.empty() && auxVariables.empty(), storm::exceptions::InvalidOperationException,
199 "Variables have already been created.");
200
201 for (uint64_t index = 0; index < player1VariableCount; ++index) {
202 storm::expressions::Variable newVariable = ddManager->addMetaVariable("pl1." + std::to_string(index)).first;
203 player1Variables.push_back(newVariable);
204 player1VariableBdds.push_back(ddManager->getEncoding(newVariable, 1));
205 }
206 STORM_LOG_DEBUG("Created " << player1VariableCount << " player 1 variables.");
207
208 for (uint64_t index = 0; index < player2VariableCount; ++index) {
209 storm::expressions::Variable newVariable = ddManager->addMetaVariable("pl2." + std::to_string(index)).first;
210 player2Variables.push_back(newVariable);
211 player2VariableBdds.push_back(ddManager->getEncoding(newVariable, 1));
212 }
213 STORM_LOG_DEBUG("Created " << player2VariableCount << " player 2 variables.");
214
215 for (uint64_t index = 0; index < auxVariableCount; ++index) {
216 storm::expressions::Variable newVariable = ddManager->addMetaVariable("aux_" + std::to_string(index)).first;
217 auxVariables.push_back(newVariable);
218 auxVariableBdds.push_back(ddManager->getEncoding(newVariable, 1));
219 }
220 STORM_LOG_DEBUG("Created " << auxVariableCount << " auxiliary variables.");
221
222 bottomStateVariables = ddManager->addMetaVariable("bot");
223 bottomStateBdds = std::make_pair(ddManager->getEncoding(bottomStateVariables.first, 1), ddManager->getEncoding(bottomStateVariables.second, 1));
225}
226
227template<storm::dd::DdType DdType>
229 return encodeChoice(index, 0, end, player1VariableBdds);
230}
231
232template<storm::dd::DdType DdType>
233uint_fast64_t AbstractionInformation<DdType>::decodePlayer1Choice(storm::expressions::Valuation const& valuation, uint_fast64_t end) const {
234 return decodeChoice(valuation, 0, end, player1Variables);
235}
236
237template<storm::dd::DdType DdType>
238storm::dd::Bdd<DdType> AbstractionInformation<DdType>::encodePlayer2Choice(uint_fast64_t index, uint_fast64_t start, uint_fast64_t end) const {
239 return encodeChoice(index, start, end, player2VariableBdds);
240}
241
242template<storm::dd::DdType DdType>
243uint_fast64_t AbstractionInformation<DdType>::decodePlayer2Choice(storm::expressions::Valuation const& valuation, uint_fast64_t end) const {
244 return decodeChoice(valuation, 0, end, player2Variables);
245}
246
247template<storm::dd::DdType DdType>
248storm::dd::Bdd<DdType> AbstractionInformation<DdType>::encodeAux(uint_fast64_t index, uint_fast64_t start, uint_fast64_t end) const {
249 return encodeChoice(index, start, end, auxVariableBdds);
250}
251
252template<storm::dd::DdType DdType>
253uint_fast64_t AbstractionInformation<DdType>::decodeAux(storm::expressions::Valuation const& valuation, uint_fast64_t start, uint_fast64_t end) const {
254 return decodeChoice(valuation, start, end, auxVariables);
255}
256
257template<storm::dd::DdType DdType>
258std::vector<storm::expressions::Variable> const& AbstractionInformation<DdType>::getPlayer1Variables() const {
259 return player1Variables;
260}
261
262template<storm::dd::DdType DdType>
263std::set<storm::expressions::Variable> AbstractionInformation<DdType>::getPlayer1VariableSet(uint_fast64_t count) const {
264 return std::set<storm::expressions::Variable>(player1Variables.begin(), player1Variables.begin() + count);
265}
266
267template<storm::dd::DdType DdType>
268std::vector<storm::expressions::Variable> const& AbstractionInformation<DdType>::getPlayer2Variables() const {
269 return player2Variables;
270}
271
272template<storm::dd::DdType DdType>
273std::set<storm::expressions::Variable> AbstractionInformation<DdType>::getPlayer2VariableSet(uint_fast64_t count) const {
274 return std::set<storm::expressions::Variable>(player2Variables.begin(), player2Variables.begin() + count);
275}
276
277template<storm::dd::DdType DdType>
278std::vector<storm::expressions::Variable> const& AbstractionInformation<DdType>::getAuxVariables() const {
279 return auxVariables;
280}
281
282template<storm::dd::DdType DdType>
284 return auxVariables[index];
285}
286
287template<storm::dd::DdType DdType>
288std::set<storm::expressions::Variable> AbstractionInformation<DdType>::getAuxVariableSet(uint_fast64_t start, uint_fast64_t end) const {
289 return std::set<storm::expressions::Variable>(auxVariables.begin() + start, auxVariables.begin() + end);
290}
291
292template<storm::dd::DdType DdType>
293std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSourceVariables() const {
294 return sourceVariables;
295}
296
297template<storm::dd::DdType DdType>
298std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSuccessorVariables() const {
299 return successorVariables;
300}
301
302template<storm::dd::DdType DdType>
303std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSourcePredicateVariables() const {
305}
306
307template<storm::dd::DdType DdType>
308std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSuccessorPredicateVariables() const {
310}
311
312template<storm::dd::DdType DdType>
313std::vector<storm::expressions::Variable> const& AbstractionInformation<DdType>::getOrderedSourcePredicateVariables() const {
315}
316
317template<storm::dd::DdType DdType>
318std::vector<storm::expressions::Variable> const& AbstractionInformation<DdType>::getOrderedSuccessorPredicateVariables() const {
320}
321
322template<storm::dd::DdType DdType>
326template<storm::dd::DdType DdType>
330
331template<storm::dd::DdType DdType>
335
336template<storm::dd::DdType DdType>
340
341template<storm::dd::DdType DdType>
343 return auxVariables.size();
344}
345
346template<storm::dd::DdType DdType>
347std::map<storm::expressions::Expression, storm::dd::Bdd<DdType>> const& AbstractionInformation<DdType>::getPredicateToBddMap() const {
348 return expressionToBddMap;
349}
350
351template<storm::dd::DdType DdType>
352std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>> const& AbstractionInformation<DdType>::getSourceSuccessorVariablePairs()
353 const {
355}
356
357template<storm::dd::DdType DdType>
358std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>> const&
362
363template<storm::dd::DdType DdType>
365 if (source) {
366 return bottomStateVariables.first;
367 } else {
368 return bottomStateVariables.second;
369 }
370}
371
372template<storm::dd::DdType DdType>
374 if (source) {
375 if (negated) {
376 return !bottomStateBdds.first;
377 } else {
378 return bottomStateBdds.first;
379 }
380 } else {
381 if (negated) {
382 return !bottomStateBdds.second;
383 } else {
384 return bottomStateBdds.second;
385 }
386 }
387}
388
389template<storm::dd::DdType DdType>
391 return predicateBdds[predicateIndex].first;
392}
393
394template<storm::dd::DdType DdType>
396 return predicateBdds[predicateIndex].second;
397}
398
399template<storm::dd::DdType DdType>
401 return predicateIdentities[predicateIndex];
402}
403
404template<storm::dd::DdType DdType>
406 auto indexIt = ddVariableIndexToPredicateIndexMap.find(ddVariableIndex);
407 STORM_LOG_THROW(indexIt != ddVariableIndexToPredicateIndexMap.end(), storm::exceptions::InvalidOperationException, "Unknown DD variable index.");
408 return predicates[indexIt->second];
409}
410
411template<storm::dd::DdType DdType>
412std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>> AbstractionInformation<DdType>::declareNewVariables(
413 std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>> const& oldPredicates, std::set<uint_fast64_t> const& newPredicates) const {
414 std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>> result;
415
416 auto oldIt = oldPredicates.begin();
417 auto oldIte = oldPredicates.end();
418 auto newIt = newPredicates.begin();
419 auto newIte = newPredicates.end();
420
421 for (; newIt != newIte; ++newIt) {
422 if (oldIt == oldIte || oldIt->second != *newIt) {
423 result.push_back(std::make_pair(expressionManager.get().declareFreshBooleanVariable(), *newIt));
424 } else {
425 ++oldIt;
426 }
427 }
428
429 return result;
430}
431
432template<storm::dd::DdType DdType>
433storm::dd::Bdd<DdType> AbstractionInformation<DdType>::encodeChoice(uint_fast64_t index, uint_fast64_t start, uint_fast64_t end,
434 std::vector<storm::dd::Bdd<DdType>> const& variables) const {
435 storm::dd::Bdd<DdType> result = ddManager->getBddOne();
436 for (uint_fast64_t bitIndex = end; bitIndex > start; --bitIndex) {
437 if ((index & 1) != 0) {
438 result &= variables[bitIndex - 1];
439 } else {
440 result &= !variables[bitIndex - 1];
441 }
442 index >>= 1;
443 }
444 STORM_LOG_ASSERT(!result.isZero(), "BDD encoding must not be zero.");
445 return result;
446}
447
448template<storm::dd::DdType DdType>
449uint_fast64_t AbstractionInformation<DdType>::decodeChoice(storm::expressions::Valuation const& valuation, uint_fast64_t start, uint_fast64_t end,
450 std::vector<storm::expressions::Variable> const& variables) const {
451 uint_fast64_t result = 0;
452 for (uint_fast64_t variableIndex = start; variableIndex < end; ++variableIndex) {
453 result <<= 1;
454 if (valuation.getBooleanValue(variables[variableIndex])) {
455 result |= 1;
456 }
457 }
458 return result;
459}
460
461template<storm::dd::DdType DdType>
463 STORM_LOG_ASSERT(state.getNonZeroCount() == 1, "Wrong number of non-zero entries.");
464
465 storm::storage::BitVector statePredicates(this->getNumberOfPredicates());
466
467 storm::dd::Add<DdType, double> add = state.template toAdd<double>();
468 auto it = add.begin();
469 auto stateValuePair = *it;
470 for (uint_fast64_t index = 0; index < this->getOrderedSourcePredicateVariables().size(); ++index) {
471 auto const& successorVariable = this->getOrderedSourcePredicateVariables()[index];
472 if (stateValuePair.first.getBooleanValue(successorVariable)) {
473 statePredicates.set(index);
474 }
475 }
476
477 return statePredicates;
478}
479
480template<storm::dd::DdType DdType>
481template<typename ValueType>
482std::map<uint_fast64_t, std::pair<storm::storage::BitVector, ValueType>> AbstractionInformation<DdType>::decodeChoiceToUpdateSuccessorMapping(
483 storm::dd::Bdd<DdType> const& choice) const {
484 std::map<uint_fast64_t, std::pair<storm::storage::BitVector, ValueType>> result;
485
486 storm::dd::Add<DdType, ValueType> lowerChoiceAsAdd = choice.template toAdd<ValueType>();
487 for (auto const& successorValuePair : lowerChoiceAsAdd) {
488 uint_fast64_t updateIndex = this->decodeAux(successorValuePair.first, 0, this->getAuxVariableCount());
489
491 for (uint_fast64_t index = 0; index < this->getOrderedSuccessorPredicateVariables().size(); ++index) {
492 auto const& successorVariable = this->getOrderedSuccessorPredicateVariables()[index];
493 if (successorValuePair.first.getBooleanValue(successorVariable)) {
494 successor.set(index);
495 }
496 }
497
498 result[updateIndex] = std::make_pair(successor, successorValuePair.second);
499 }
500 return result;
501}
502
503template<storm::dd::DdType DdType>
504template<typename ValueType>
505std::vector<std::map<uint_fast64_t, std::pair<storm::storage::BitVector, ValueType>>> AbstractionInformation<DdType>::decodeChoicesToUpdateSuccessorMapping(
506 std::set<storm::expressions::Variable> const& player2Variables, storm::dd::Bdd<DdType> const& choices) const {
507 std::vector<storm::dd::Bdd<DdType>> splitChoices = choices.split(player2Variables);
508
509 std::vector<std::map<uint_fast64_t, std::pair<storm::storage::BitVector, ValueType>>> result;
510 for (auto const& choice : splitChoices) {
511 result.emplace_back(this->template decodeChoiceToUpdateSuccessorMapping<ValueType>(choice));
512 }
513
514 return result;
515}
516
517template<storm::dd::DdType DdType>
518std::tuple<storm::storage::BitVector, uint64_t, uint64_t> AbstractionInformation<DdType>::decodeStatePlayer1ChoiceAndUpdate(
519 storm::dd::Bdd<DdType> const& stateChoiceAndUpdate) const {
520 STORM_LOG_ASSERT(stateChoiceAndUpdate.getNonZeroCount() == 1, "Wrong number of non-zero entries.");
521
522 storm::storage::BitVector statePredicates(this->getNumberOfPredicates());
523
524 storm::dd::Add<DdType, double> add = stateChoiceAndUpdate.template toAdd<double>();
525 auto it = add.begin();
526 auto stateValuePair = *it;
527 uint64_t choiceIndex = this->decodePlayer1Choice(stateValuePair.first, this->getPlayer1VariableCount());
528 uint64_t updateIndex = this->decodeAux(stateValuePair.first, 0, this->getAuxVariableCount());
529 for (uint_fast64_t index = 0; index < this->getOrderedSourcePredicateVariables().size(); ++index) {
530 auto const& successorVariable = this->getOrderedSourcePredicateVariables()[index];
531
532 if (stateValuePair.first.getBooleanValue(successorVariable)) {
533 statePredicates.set(index);
534 }
535 }
536
537 return std::make_tuple(statePredicates, choiceIndex, updateIndex);
538}
539
540template<storm::dd::DdType DdType>
541std::pair<std::pair<storm::expressions::Variable, storm::expressions::Variable>, uint64_t> AbstractionInformation<DdType>::addLocationVariables(
542 storm::expressions::Variable const& locationExpressionVariable, uint64_t highestLocationIndex) {
543 auto newMetaVariable = ddManager->addMetaVariable("loc_" + std::to_string(locationVariablePairs.size()), 0, highestLocationIndex);
544
545 locationExpressionVariables.insert(locationExpressionVariable);
546 locationExpressionToDdVariableMap.emplace(locationExpressionVariable, newMetaVariable);
547 locationVariablePairs.emplace_back(newMetaVariable);
548 allSourceLocationVariables.insert(newMetaVariable.first);
549 sourceVariables.insert(newMetaVariable.first);
550 allSuccessorLocationVariables.insert(newMetaVariable.second);
551 successorVariables.insert(newMetaVariable.second);
552 extendedPredicateDdVariables.emplace_back(newMetaVariable);
553 allLocationIdentities &= ddManager->getIdentity(newMetaVariable.first, newMetaVariable.second);
554 return std::make_pair(locationVariablePairs.back(), locationVariablePairs.size() - 1);
555}
556
557template<storm::dd::DdType DdType>
559 if (source) {
560 return locationVariablePairs[locationVariableIndex].first;
561 } else {
562 return locationVariablePairs[locationVariableIndex].second;
563 }
564}
565
566template<storm::dd::DdType DdType>
567std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSourceLocationVariables() const {
569}
570
571template<storm::dd::DdType DdType>
572std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSuccessorLocationVariables() const {
574}
575
576template<storm::dd::DdType DdType>
578 bool source) {
579 auto const& metaVariablePair = locationExpressionToDdVariableMap.at(locationExpressionVariable);
580 if (source) {
581 return metaVariablePair.first;
582 } else {
583 return metaVariablePair.second;
584 }
585}
586
587template<storm::dd::DdType DdType>
589 uint64_t result = 0;
590 for (auto const& locationVariableToMetaVariablePair : locationExpressionToDdVariableMap) {
591 result += ddManager->getMetaVariable(locationVariableToMetaVariablePair.second.first).getNumberOfDdVariables();
592 }
593 return result;
594}
595
596template<storm::dd::DdType DdType>
597std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getLocationExpressionVariables() const {
599}
600
601template<storm::dd::DdType DdType>
603 return this->getDdManager().getEncoding(locationVariable, locationIndex);
604}
605
608
609template std::map<uint_fast64_t, std::pair<storm::storage::BitVector, double>>
611template std::map<uint_fast64_t, std::pair<storm::storage::BitVector, double>>
613template std::map<uint_fast64_t, std::pair<storm::storage::BitVector, storm::RationalNumber>>
615
616template std::vector<std::map<uint_fast64_t, std::pair<storm::storage::BitVector, double>>>
617AbstractionInformation<storm::dd::DdType::CUDD>::decodeChoicesToUpdateSuccessorMapping(std::set<storm::expressions::Variable> const& player2Variables,
618 storm::dd::Bdd<storm::dd::DdType::CUDD> const& choices) const;
619template std::vector<std::map<uint_fast64_t, std::pair<storm::storage::BitVector, double>>>
620AbstractionInformation<storm::dd::DdType::Sylvan>::decodeChoicesToUpdateSuccessorMapping(std::set<storm::expressions::Variable> const& player2Variables,
621 storm::dd::Bdd<storm::dd::DdType::Sylvan> const& choices) const;
622template std::vector<std::map<uint_fast64_t, std::pair<storm::storage::BitVector, storm::RationalNumber>>>
623AbstractionInformation<storm::dd::DdType::Sylvan>::decodeChoicesToUpdateSuccessorMapping(std::set<storm::expressions::Variable> const& player2Variables,
624 storm::dd::Bdd<storm::dd::DdType::Sylvan> const& choices) const;
625} // namespace abstraction
626} // namespace storm::gbar
AddIterator< LibraryType, ValueType > begin(bool enumerateDontCareMetaVariables=true) const
Retrieves an iterator that points to the first meta variable assignment with a non-zero function valu...
Definition Add.cpp:1142
bool isZero() const
Retrieves whether this DD represents the constant zero function.
Definition Bdd.cpp:541
virtual uint_fast64_t getNonZeroCount() const override
Retrieves the number of encodings that are mapped to a non-zero value.
Definition Bdd.cpp:507
std::vector< Bdd< LibraryType > > split(std::set< storm::expressions::Variable > const &variables) const
Splits the BDD along the given variables (must be at the top).
Definition Bdd.cpp:467
This class is responsible for managing a set of typed variables and all expressions using these varia...
The base class of all valuations of variables.
Definition Valuation.h:15
virtual bool getBooleanValue(Variable const &booleanVariable) const =0
Retrieves the value of the given boolean variable.
std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > predicateDdVariables
The DD variables corresponding to the predicates.
std::vector< storm::expressions::Variable > orderedSourcePredicateVariables
An ordered collection of the source variables.
std::vector< std::pair< storm::dd::Bdd< DdType >, storm::dd::Bdd< DdType > > > predicateBdds
The BDDs corresponding to the predicates.
std::set< storm::expressions::Variable > const & getSourceLocationVariables() const
Retrieves the source location variables.
storm::dd::Bdd< DdType > allPredicateIdentities
A BDD that represents the identity of all predicate variables.
storm::dd::Bdd< DdType > getPredicateSourceVariable(storm::expressions::Expression const &predicate) const
Retrieves the source variable associated with the given predicate.
storm::dd::Bdd< DdType > encodePlayer1Choice(uint_fast64_t index, uint_fast64_t end) const
Encodes the given index using the indicated player 1 variables.
std::size_t getPlayer2VariableCount() const
Retrieves the number of player 2 variables.
std::map< storm::expressions::Expression, storm::dd::Bdd< DdType > > const & getPredicateToBddMap() const
Retrieves a mapping of the known predicates to the BDDs that represent the corresponding states.
std::set< storm::expressions::Variable > getPlayer1VariableSet(uint_fast64_t count) const
Retrieves the set of player 1 variables.
storm::dd::Bdd< DdType > const & encodePredicateAsSource(uint_fast64_t predicateIndex) const
Retrieves the BDD for the predicate with the given index over the source variables.
std::vector< storm::expressions::Variable > const & getPlayer2Variables() const
Retrieves the meta variables associated with the player 2 choices.
storm::expressions::Variable const & getDdLocationMetaVariable(storm::expressions::Variable const &locationExpressionVariable, bool source)
Retrieves the DD variable for the given location expression variable.
uint_fast64_t decodeChoice(storm::expressions::Valuation const &valuation, uint_fast64_t start, uint_fast64_t end, std::vector< storm::expressions::Variable > const &variables) const
Decodes the index encoded in the valuation using the given variables.
std::vector< storm::expressions::Expression > const & getConstraints() const
Retrieves a list of expressions that constrain the valid variable values.
std::set< storm::expressions::Variable > abstractedVariables
The set of all abstracted variables.
void addExpressionVariable(storm::expressions::Variable const &variable)
Adds the given variable.
std::vector< storm::expressions::Variable > auxVariables
Variables that can be used to encode auxiliary information.
std::vector< std::map< uint_fast64_t, std::pair< storm::storage::BitVector, ValueType > > > decodeChoicesToUpdateSuccessorMapping(std::set< storm::expressions::Variable > const &player2Variables, storm::dd::Bdd< DdType > const &choices) const
Decodes the choices in the form of BDD over the destination variables where the choices are distingui...
std::set< storm::expressions::Variable > successorPredicateVariables
The set of all successor predicate variables.
storm::dd::Bdd< DdType > encodeChoice(uint_fast64_t index, uint_fast64_t start, uint_fast64_t end, std::vector< storm::dd::Bdd< DdType > > const &variables) const
Encodes the given index with the given number of variables from the given variables.
std::set< storm::expressions::Variable > successorVariables
The set of all successor variables.
std::set< storm::expressions::Variable > allSuccessorLocationVariables
std::vector< storm::expressions::Variable > const & getAuxVariables() const
Retrieves the meta variables associated with auxiliary information.
bool hasPredicate(storm::expressions::Expression const &predicate) const
Determines whether the given predicate is in the set of known predicates.
storm::expressions::ExpressionManager & getExpressionManager()
Retrieves the expression manager.
std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > extendedPredicateDdVariables
The DD variables corresponding to the predicates together with the DD variables marking the bottom st...
std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const & getSourceSuccessorVariablePairs() const
Retrieves the meta variables pairs for all predicates.
storm::dd::Bdd< DdType > encodeLocation(storm::expressions::Variable const &locationVariable, uint64_t locationIndex) const
Encodes the given location index as either source or successor.
AbstractionInformation(storm::Environment const &env, storm::expressions::ExpressionManager &expressionManager, std::set< storm::expressions::Variable > const &abstractedVariables, std::unique_ptr< storm::solver::SmtSolver > &&smtSolver, AbstractionInformationOptions const &options=AbstractionInformationOptions())
Creates a new abstraction information object.
std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const & getExtendedSourceSuccessorVariablePairs() const
Retrieves the meta variables pairs for all predicates together with the meta variables marking the bo...
std::set< storm::expressions::Variable > allSourceLocationVariables
std::set< storm::expressions::Variable > sourceVariables
The set of all source variables.
std::vector< storm::expressions::Variable > player1Variables
Variables that encode the choices of player 1.
storm::dd::Bdd< DdType > const & getPredicateIdentity(uint_fast64_t predicateIndex) const
Retrieves a BDD representing the identity for the predicate with the given index.
std::size_t getAuxVariableCount() const
Retrieves the number of auxiliary variables.
std::size_t getPlayer1VariableCount() const
Retrieves the number of player 1 variables.
storm::expressions::EquivalenceChecker equivalenceChecker
An object that can detect equivalence of predicates.
storm::dd::Bdd< DdType > const & getAllPredicateIdentities() const
Retrieves a BDD representing the identities of all predicates.
std::set< storm::expressions::Variable > getAuxVariableSet(uint_fast64_t start, uint_fast64_t end) const
Retrieves the requested set of auxiliary variables.
std::vector< storm::dd::Bdd< DdType > > auxVariableBdds
The BDDs associated with the meta variables encoding auxiliary information.
std::vector< storm::expressions::Variable > const & getPlayer1Variables() const
Retrieves the meta variables associated with the player 1 choices.
storm::storage::BitVector decodeState(storm::dd::Bdd< DdType > const &state) const
Decodes the given state (given as a BDD over the source variables) into a a bit vector indicating the...
storm::dd::Bdd< DdType > allLocationIdentities
A BDD that represents the identity of all location variables.
std::pair< storm::dd::Bdd< DdType >, storm::dd::Bdd< DdType > > bottomStateBdds
The BDDs associated with the bottom state variable pair.
std::set< storm::expressions::Variable > const & getSuccessorLocationVariables() const
Retrieves the source location variables.
std::pair< storm::expressions::Variable, storm::expressions::Variable > bottomStateVariables
A meta variable pair that marks bottom states.
uint64_t getNumberOfDdSourceLocationVariables() const
Retrieves the number of DD variables associated with the source location variables.
std::shared_ptr< storm::dd::DdManager< DdType > > ddManager
The manager responsible for the DDs.
std::vector< storm::dd::Bdd< DdType > > predicateIdentities
The BDDs representing the predicate identities (i.e. source and successor variable have the same trut...
std::vector< storm::expressions::Expression > getPredicatesExcludingBottom(storm::storage::BitVector const &predicateValuation) const
Retrieves a list of expression that corresponds to the given predicate valuation that mentions all of...
std::map< storm::expressions::Expression, storm::dd::Bdd< DdType > > expressionToBddMap
A mapping from expressions to the corresponding BDDs.
std::vector< storm::expressions::Expression > predicates
The current set of predicates used in the abstraction.
std::unordered_map< uint_fast64_t, uint_fast64_t > ddVariableIndexToPredicateIndexMap
A mapping from DD variable indices to the predicate index they represent.
std::vector< storm::expressions::Variable > player2Variables
Variables that encode the choices of player 2.
void addConstraint(storm::expressions::Expression const &constraint)
Adds an expression that constrains the legal variable values.
std::vector< storm::expressions::Variable > orderedSuccessorPredicateVariables
An ordered collection of the successor variables.
std::vector< storm::expressions::Expression > const & getPredicates() const
Retrieves all currently known predicates.
std::vector< storm::expressions::Expression > constraints
The expressions characterizing legal variable values.
std::vector< std::pair< storm::expressions::Variable, uint_fast64_t > > declareNewVariables(std::vector< std::pair< storm::expressions::Variable, uint_fast64_t > > const &oldPredicates, std::set< uint_fast64_t > const &newPredicates) const
Declares new variables for the missing predicates.
std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > locationVariablePairs
The location variable pairs (source/successor).
storm::expressions::Variable getLocationVariable(uint64_t locationVariableIndex, bool source) const
Retrieves the location variable with the given index as either source or successor.
std::set< storm::expressions::Variable > const & getSuccessorPredicateVariables() const
Retrieves the set of successor predicate meta variables.
std::set< storm::expressions::Variable > const & getSourceVariables() const
Retrieves the set of source meta variables.
uint_fast64_t decodePlayer2Choice(storm::expressions::Valuation const &valuation, uint_fast64_t end) const
Decodes the player 2 choice in the given valuation.
storm::expressions::Variable const & getAuxVariable(uint_fast64_t index) const
Retrieves the auxiliary variable with the given index.
uint_fast64_t decodePlayer1Choice(storm::expressions::Valuation const &valuation, uint_fast64_t end) const
Decodes the player 1 choice in the given valuation.
std::set< storm::expressions::Variable > sourcePredicateVariables
The set of all source predicate variables.
uint_fast64_t decodeAux(storm::expressions::Valuation const &valuation, uint_fast64_t start, uint_fast64_t end) const
Decodes the auxiliary index in the given valuation.
void createEncodingVariables(uint64_t player1VariableCount, uint64_t player2VariableCount, uint64_t auxVariableCount)
Creates the given number of variables used to encode the choices of player 1/2 and auxiliary informat...
std::size_t getNumberOfPredicates() const
Retrieves the number of predicates.
std::pair< std::pair< storm::expressions::Variable, storm::expressions::Variable >, uint64_t > addLocationVariables(storm::expressions::Variable const &locationExpressionVariable, uint64_t highestLocationIndex)
Adds a location variable of appropriate range and returns the pair of meta variables.
std::tuple< storm::storage::BitVector, uint64_t, uint64_t > decodeStatePlayer1ChoiceAndUpdate(storm::dd::Bdd< DdType > const &stateChoiceAndUpdate) const
Decodes the given BDD (over source, player 1 and aux variables) into a bit vector indicating the trut...
std::vector< storm::expressions::Variable > const & getOrderedSourcePredicateVariables() const
Retrieves the ordered collection of source predicate meta variables.
std::vector< storm::expressions::Variable > const & getOrderedSuccessorPredicateVariables() const
Retrieves the ordered collection of successor predicate meta variables.
storm::expressions::Variable const & getBottomStateVariable(bool source) const
Retrieves the meta variable marking the bottom states.
std::set< storm::expressions::Variable > getPlayer2VariableSet(uint_fast64_t count) const
Retrieves the set of player 2 variables.
storm::dd::Bdd< DdType > encodeAux(uint_fast64_t index, uint_fast64_t start, uint_fast64_t end) const
Encodes the given index using the indicated auxiliary variables.
storm::expressions::Expression const & getPredicateForDdVariableIndex(uint_fast64_t ddVariableIndex) const
Retrieves the predicate associated with the given DD variable index.
storm::dd::Bdd< DdType > const & encodePredicateAsSuccessor(uint_fast64_t predicateIndex) const
Retrieves the BDD for the predicate with the given index over the successor variables.
std::reference_wrapper< storm::expressions::ExpressionManager > expressionManager
The manager responsible for the expressions of the program and the SMT solvers.
std::vector< storm::dd::Bdd< DdType > > player2VariableBdds
The BDDs associated with the meta variables of player 2.
std::set< storm::expressions::Variable > const & getSuccessorVariables() const
Retrieves the set of successor meta variables.
std::vector< storm::dd::Bdd< DdType > > player1VariableBdds
The BDDs associated with the meta variables of player 1.
storm::dd::DdManager< DdType > & getDdManager()
Retrieves the DD manager.
std::set< storm::expressions::Variable > const & getSourcePredicateVariables() const
Retrieves the set of source predicate meta variables.
std::set< storm::expressions::Variable > const & getLocationExpressionVariables() const
Retrieves the source location variables.
storm::expressions::Expression const & getPredicateByIndex(uint_fast64_t index) const
Retrieves the predicate with the given index.
uint_fast64_t getOrAddPredicate(storm::expressions::Expression const &predicate)
Gets the index of a predicate that is equivalent to the provided one.
std::shared_ptr< storm::dd::DdManager< DdType > > getDdManagerAsSharedPointer()
Retrieves the shared pointer to the DD manager.
storm::dd::Bdd< DdType > getBottomStateBdd(bool source, bool negated) const
Retrieves the BDD that can be used to mark the bottom states.
std::unordered_map< storm::expressions::Expression, uint64_t > predicateToIndexMap
A mapping from predicates to their indices in the predicate list.
std::vector< uint_fast64_t > addPredicates(std::vector< storm::expressions::Expression > const &predicates)
Adds the given predicates.
std::map< storm::expressions::Variable, std::pair< storm::expressions::Variable, storm::expressions::Variable > > locationExpressionToDdVariableMap
A mapping from location expression variables to their source/successor counterparts.
storm::dd::Bdd< DdType > const & getAllLocationIdentities() const
Retrieves a BDD representing the identities of all location variables.
std::set< storm::expressions::Variable > const & getAbstractedVariables() const
Retrieves all currently known variables.
std::map< uint_fast64_t, std::pair< storm::storage::BitVector, ValueType > > decodeChoiceToUpdateSuccessorMapping(storm::dd::Bdd< DdType > const &choice) const
Decodes the choice in the form of a BDD over the destination variables.
std::set< storm::expressions::Variable > locationExpressionVariables
The set of all location expression variables.
storm::dd::Bdd< DdType > encodePlayer2Choice(uint_fast64_t index, uint_fast64_t start, uint_fast64_t end) const
Encodes the given index using the indicated player 2 variables.
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
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.
#define STORM_LOG_DEBUG(message)
Definition logging.h:21
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:9
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:28