Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
AbstractionInformation.cpp
Go to the documentation of this file.
2
4
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,
20 std::shared_ptr<storm::dd::DdManager<DdType>> ddManager)
21 : expressionManager(expressionManager),
22 equivalenceChecker(std::move(smtSolver)),
23 abstractedVariables(abstractedVariables),
24 constraints(options.constraints),
25 ddManager(ddManager),
26 allPredicateIdentities(ddManager->getBddOne()),
27 allLocationIdentities(ddManager->getBddOne()),
28 expressionToBddMap() {
29 // Intentionally left empty.
30}
31
32template<storm::dd::DdType DdType>
34 abstractedVariables.insert(variable);
35}
36
37template<storm::dd::DdType DdType>
39 addExpressionVariable(variable);
40 addConstraint(constraint);
41}
42
43template<storm::dd::DdType DdType>
45 constraints.push_back(constraint);
46}
47
48template<storm::dd::DdType DdType>
50 // Check if we already have an equivalent predicate.
51 for (uint64_t index = 0; index < predicates.size(); ++index) {
52 auto const& oldPredicate = predicates[index];
53 if (equivalenceChecker.areEquivalent(oldPredicate, predicate)) {
54 expressionToBddMap[predicate] = expressionToBddMap.at(oldPredicate);
55 return index;
56 }
57 }
58
59 std::size_t predicateIndex = predicates.size();
60 predicateToIndexMap[predicate] = predicateIndex;
61
62 // Add the new predicate to the list of known predicates.
63 predicates.push_back(predicate);
64
65 // Add DD variables for the new predicate.
66 std::stringstream stream;
67 stream << predicate;
68 std::pair<storm::expressions::Variable, storm::expressions::Variable> newMetaVariable = ddManager->addMetaVariable(stream.str());
69
70 predicateDdVariables.push_back(newMetaVariable);
71 extendedPredicateDdVariables.push_back(newMetaVariable);
72 predicateBdds.emplace_back(ddManager->getEncoding(newMetaVariable.first, 1), ddManager->getEncoding(newMetaVariable.second, 1));
73 predicateIdentities.push_back(ddManager->getEncoding(newMetaVariable.first, 1).iff(ddManager->getEncoding(newMetaVariable.second, 1)));
74 allPredicateIdentities &= predicateIdentities.back();
75 sourceVariables.insert(newMetaVariable.first);
76 successorVariables.insert(newMetaVariable.second);
77 sourcePredicateVariables.insert(newMetaVariable.first);
78 successorPredicateVariables.insert(newMetaVariable.second);
79 orderedSourcePredicateVariables.push_back(newMetaVariable.first);
80 orderedSuccessorPredicateVariables.push_back(newMetaVariable.second);
81 ddVariableIndexToPredicateIndexMap[predicateIdentities.back().getIndex()] = predicateIndex;
82 expressionToBddMap[predicate] = predicateBdds[predicateIndex].first && !bottomStateBdds.first;
83
84 return predicateIndex;
85}
86
87template<storm::dd::DdType DdType>
88std::vector<uint_fast64_t> AbstractionInformation<DdType>::addPredicates(std::vector<storm::expressions::Expression> const& predicates) {
89 std::vector<uint_fast64_t> predicateIndices;
90 for (auto const& predicate : predicates) {
91 predicateIndices.push_back(this->getOrAddPredicate(predicate));
92 }
93 return predicateIndices;
94}
95
96template<storm::dd::DdType DdType>
97std::vector<storm::expressions::Expression> const& AbstractionInformation<DdType>::getConstraints() const {
98 return constraints;
99}
100
101template<storm::dd::DdType DdType>
105
106template<storm::dd::DdType DdType>
110
111template<storm::dd::DdType DdType>
115
116template<storm::dd::DdType DdType>
120
121template<storm::dd::DdType DdType>
122std::shared_ptr<storm::dd::DdManager<DdType>> AbstractionInformation<DdType>::getDdManagerAsSharedPointer() {
123 return ddManager;
124}
125
126template<storm::dd::DdType DdType>
127std::shared_ptr<storm::dd::DdManager<DdType> const> AbstractionInformation<DdType>::getDdManagerAsSharedPointer() const {
128 return ddManager;
129}
130
131template<storm::dd::DdType DdType>
132std::vector<storm::expressions::Expression> const& AbstractionInformation<DdType>::getPredicates() const {
133 return predicates;
134}
135
136template<storm::dd::DdType DdType>
137std::vector<storm::expressions::Expression> AbstractionInformation<DdType>::getPredicates(storm::storage::BitVector const& predicateValuation) const {
138 STORM_LOG_ASSERT(predicateValuation.size() == this->getNumberOfPredicates(), "Size of predicate valuation does not match number of predicates.");
139
140 std::vector<storm::expressions::Expression> result;
141 for (uint64_t index = 0; index < this->getNumberOfPredicates(); ++index) {
142 if (predicateValuation[index]) {
143 result.push_back(this->getPredicateByIndex(index));
144 } else {
145 result.push_back(!this->getPredicateByIndex(index));
146 }
147 }
148
149 return result;
150}
151
152template<storm::dd::DdType DdType>
153std::vector<storm::expressions::Expression> AbstractionInformation<DdType>::getPredicatesExcludingBottom(
154 storm::storage::BitVector const& predicateValuation) const {
155 uint64_t offset = 1 + this->getNumberOfDdSourceLocationVariables();
156 STORM_LOG_ASSERT(predicateValuation.size() == this->getNumberOfPredicates() + offset, "Size of predicate valuation does not match number of predicates.");
157
158 std::vector<storm::expressions::Expression> result;
159 for (uint64_t index = 0; index < this->getNumberOfPredicates(); ++index) {
160 if (predicateValuation[index + offset]) {
161 result.push_back(this->getPredicateByIndex(index));
162 } else {
163 result.push_back(!this->getPredicateByIndex(index));
164 }
165 }
166
167 return result;
168}
169
170template<storm::dd::DdType DdType>
172 return predicates[index];
173}
174
175template<storm::dd::DdType DdType>
177 auto indexIt = predicateToIndexMap.find(predicate);
178 STORM_LOG_THROW(indexIt != predicateToIndexMap.end(), storm::exceptions::InvalidOperationException, "Cannot retrieve BDD for unknown predicate.");
179 return predicateBdds[indexIt->second].first;
180}
181
182template<storm::dd::DdType DdType>
184 return predicateToIndexMap.find(predicate) != predicateToIndexMap.end();
185}
186
187template<storm::dd::DdType DdType>
189 return predicates.size();
190}
191
192template<storm::dd::DdType DdType>
193std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getAbstractedVariables() const {
194 return abstractedVariables;
195}
196
197template<storm::dd::DdType DdType>
198void AbstractionInformation<DdType>::createEncodingVariables(uint64_t player1VariableCount, uint64_t player2VariableCount, uint64_t auxVariableCount) {
199 STORM_LOG_THROW(player1Variables.empty() && player2Variables.empty() && auxVariables.empty(), storm::exceptions::InvalidOperationException,
200 "Variables have already been created.");
201
202 for (uint64_t index = 0; index < player1VariableCount; ++index) {
203 storm::expressions::Variable newVariable = ddManager->addMetaVariable("pl1." + std::to_string(index)).first;
204 player1Variables.push_back(newVariable);
205 player1VariableBdds.push_back(ddManager->getEncoding(newVariable, 1));
206 }
207 STORM_LOG_DEBUG("Created " << player1VariableCount << " player 1 variables.");
208
209 for (uint64_t index = 0; index < player2VariableCount; ++index) {
210 storm::expressions::Variable newVariable = ddManager->addMetaVariable("pl2." + std::to_string(index)).first;
211 player2Variables.push_back(newVariable);
212 player2VariableBdds.push_back(ddManager->getEncoding(newVariable, 1));
213 }
214 STORM_LOG_DEBUG("Created " << player2VariableCount << " player 2 variables.");
215
216 for (uint64_t index = 0; index < auxVariableCount; ++index) {
217 storm::expressions::Variable newVariable = ddManager->addMetaVariable("aux_" + std::to_string(index)).first;
218 auxVariables.push_back(newVariable);
219 auxVariableBdds.push_back(ddManager->getEncoding(newVariable, 1));
220 }
221 STORM_LOG_DEBUG("Created " << auxVariableCount << " auxiliary variables.");
222
223 bottomStateVariables = ddManager->addMetaVariable("bot");
224 bottomStateBdds = std::make_pair(ddManager->getEncoding(bottomStateVariables.first, 1), ddManager->getEncoding(bottomStateVariables.second, 1));
225 extendedPredicateDdVariables.push_back(bottomStateVariables);
226}
227
228template<storm::dd::DdType DdType>
230 return encodeChoice(index, 0, end, player1VariableBdds);
231}
232
233template<storm::dd::DdType DdType>
234uint_fast64_t AbstractionInformation<DdType>::decodePlayer1Choice(storm::expressions::Valuation const& valuation, uint_fast64_t end) const {
235 return decodeChoice(valuation, 0, end, player1Variables);
236}
237
238template<storm::dd::DdType DdType>
239storm::dd::Bdd<DdType> AbstractionInformation<DdType>::encodePlayer2Choice(uint_fast64_t index, uint_fast64_t start, uint_fast64_t end) const {
240 return encodeChoice(index, start, end, player2VariableBdds);
241}
242
243template<storm::dd::DdType DdType>
244uint_fast64_t AbstractionInformation<DdType>::decodePlayer2Choice(storm::expressions::Valuation const& valuation, uint_fast64_t end) const {
245 return decodeChoice(valuation, 0, end, player2Variables);
246}
247
248template<storm::dd::DdType DdType>
249storm::dd::Bdd<DdType> AbstractionInformation<DdType>::encodeAux(uint_fast64_t index, uint_fast64_t start, uint_fast64_t end) const {
250 return encodeChoice(index, start, end, auxVariableBdds);
251}
252
253template<storm::dd::DdType DdType>
254uint_fast64_t AbstractionInformation<DdType>::decodeAux(storm::expressions::Valuation const& valuation, uint_fast64_t start, uint_fast64_t end) const {
255 return decodeChoice(valuation, start, end, auxVariables);
256}
257
258template<storm::dd::DdType DdType>
259std::vector<storm::expressions::Variable> const& AbstractionInformation<DdType>::getPlayer1Variables() const {
260 return player1Variables;
261}
262
263template<storm::dd::DdType DdType>
264std::set<storm::expressions::Variable> AbstractionInformation<DdType>::getPlayer1VariableSet(uint_fast64_t count) const {
265 return std::set<storm::expressions::Variable>(player1Variables.begin(), player1Variables.begin() + count);
266}
267
268template<storm::dd::DdType DdType>
269std::vector<storm::expressions::Variable> const& AbstractionInformation<DdType>::getPlayer2Variables() const {
270 return player2Variables;
271}
272
273template<storm::dd::DdType DdType>
274std::set<storm::expressions::Variable> AbstractionInformation<DdType>::getPlayer2VariableSet(uint_fast64_t count) const {
275 return std::set<storm::expressions::Variable>(player2Variables.begin(), player2Variables.begin() + count);
276}
277
278template<storm::dd::DdType DdType>
279std::vector<storm::expressions::Variable> const& AbstractionInformation<DdType>::getAuxVariables() const {
280 return auxVariables;
281}
282
283template<storm::dd::DdType DdType>
285 return auxVariables[index];
286}
287
288template<storm::dd::DdType DdType>
289std::set<storm::expressions::Variable> AbstractionInformation<DdType>::getAuxVariableSet(uint_fast64_t start, uint_fast64_t end) const {
290 return std::set<storm::expressions::Variable>(auxVariables.begin() + start, auxVariables.begin() + end);
291}
292
293template<storm::dd::DdType DdType>
294std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSourceVariables() const {
295 return sourceVariables;
296}
297
298template<storm::dd::DdType DdType>
299std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSuccessorVariables() const {
300 return successorVariables;
301}
302
303template<storm::dd::DdType DdType>
304std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSourcePredicateVariables() const {
305 return sourcePredicateVariables;
306}
307
308template<storm::dd::DdType DdType>
309std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSuccessorPredicateVariables() const {
310 return successorPredicateVariables;
311}
312
313template<storm::dd::DdType DdType>
314std::vector<storm::expressions::Variable> const& AbstractionInformation<DdType>::getOrderedSourcePredicateVariables() const {
315 return orderedSourcePredicateVariables;
316}
317
318template<storm::dd::DdType DdType>
319std::vector<storm::expressions::Variable> const& AbstractionInformation<DdType>::getOrderedSuccessorPredicateVariables() const {
320 return orderedSuccessorPredicateVariables;
321}
322
323template<storm::dd::DdType DdType>
325 return allPredicateIdentities;
326}
327template<storm::dd::DdType DdType>
329 return allLocationIdentities;
330}
331
332template<storm::dd::DdType DdType>
334 return player1Variables.size();
335}
336
337template<storm::dd::DdType DdType>
339 return player2Variables.size();
340}
341
342template<storm::dd::DdType DdType>
344 return auxVariables.size();
345}
346
347template<storm::dd::DdType DdType>
348std::map<storm::expressions::Expression, storm::dd::Bdd<DdType>> const& AbstractionInformation<DdType>::getPredicateToBddMap() const {
349 return expressionToBddMap;
350}
351
352template<storm::dd::DdType DdType>
353std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>> const& AbstractionInformation<DdType>::getSourceSuccessorVariablePairs()
354 const {
355 return predicateDdVariables;
356}
357
358template<storm::dd::DdType DdType>
359std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>> const&
361 return extendedPredicateDdVariables;
362}
363
364template<storm::dd::DdType DdType>
366 if (source) {
367 return bottomStateVariables.first;
368 } else {
369 return bottomStateVariables.second;
370 }
371}
372
373template<storm::dd::DdType DdType>
375 if (source) {
376 if (negated) {
377 return !bottomStateBdds.first;
378 } else {
379 return bottomStateBdds.first;
380 }
381 } else {
382 if (negated) {
383 return !bottomStateBdds.second;
384 } else {
385 return bottomStateBdds.second;
386 }
387 }
388}
389
390template<storm::dd::DdType DdType>
392 return predicateBdds[predicateIndex].first;
393}
394
395template<storm::dd::DdType DdType>
397 return predicateBdds[predicateIndex].second;
398}
399
400template<storm::dd::DdType DdType>
402 return predicateIdentities[predicateIndex];
403}
404
405template<storm::dd::DdType DdType>
407 auto indexIt = ddVariableIndexToPredicateIndexMap.find(ddVariableIndex);
408 STORM_LOG_THROW(indexIt != ddVariableIndexToPredicateIndexMap.end(), storm::exceptions::InvalidOperationException, "Unknown DD variable index.");
409 return predicates[indexIt->second];
410}
411
412template<storm::dd::DdType DdType>
413std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>> AbstractionInformation<DdType>::declareNewVariables(
414 std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>> const& oldPredicates, std::set<uint_fast64_t> const& newPredicates) const {
415 std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>> result;
416
417 auto oldIt = oldPredicates.begin();
418 auto oldIte = oldPredicates.end();
419 auto newIt = newPredicates.begin();
420 auto newIte = newPredicates.end();
421
422 for (; newIt != newIte; ++newIt) {
423 if (oldIt == oldIte || oldIt->second != *newIt) {
424 result.push_back(std::make_pair(expressionManager.get().declareFreshBooleanVariable(), *newIt));
425 } else {
426 ++oldIt;
427 }
428 }
429
430 return result;
431}
432
433template<storm::dd::DdType DdType>
434storm::dd::Bdd<DdType> AbstractionInformation<DdType>::encodeChoice(uint_fast64_t index, uint_fast64_t start, uint_fast64_t end,
435 std::vector<storm::dd::Bdd<DdType>> const& variables) const {
436 storm::dd::Bdd<DdType> result = ddManager->getBddOne();
437 for (uint_fast64_t bitIndex = end; bitIndex > start; --bitIndex) {
438 if ((index & 1) != 0) {
439 result &= variables[bitIndex - 1];
440 } else {
441 result &= !variables[bitIndex - 1];
442 }
443 index >>= 1;
444 }
445 STORM_LOG_ASSERT(!result.isZero(), "BDD encoding must not be zero.");
446 return result;
447}
448
449template<storm::dd::DdType DdType>
450uint_fast64_t AbstractionInformation<DdType>::decodeChoice(storm::expressions::Valuation const& valuation, uint_fast64_t start, uint_fast64_t end,
451 std::vector<storm::expressions::Variable> const& variables) const {
452 uint_fast64_t result = 0;
453 for (uint_fast64_t variableIndex = start; variableIndex < end; ++variableIndex) {
454 result <<= 1;
455 if (valuation.getBooleanValue(variables[variableIndex])) {
456 result |= 1;
457 }
458 }
459 return result;
460}
461
462template<storm::dd::DdType DdType>
464 STORM_LOG_ASSERT(state.getNonZeroCount() == 1, "Wrong number of non-zero entries.");
465
466 storm::storage::BitVector statePredicates(this->getNumberOfPredicates());
467
468 storm::dd::Add<DdType, double> add = state.template toAdd<double>();
469 auto it = add.begin();
470 auto stateValuePair = *it;
471 for (uint_fast64_t index = 0; index < this->getOrderedSourcePredicateVariables().size(); ++index) {
472 auto const& successorVariable = this->getOrderedSourcePredicateVariables()[index];
473 if (stateValuePair.first.getBooleanValue(successorVariable)) {
474 statePredicates.set(index);
475 }
476 }
477
478 return statePredicates;
479}
480
481template<storm::dd::DdType DdType>
482template<typename ValueType>
483std::map<uint_fast64_t, std::pair<storm::storage::BitVector, ValueType>> AbstractionInformation<DdType>::decodeChoiceToUpdateSuccessorMapping(
484 storm::dd::Bdd<DdType> const& choice) const {
485 std::map<uint_fast64_t, std::pair<storm::storage::BitVector, ValueType>> result;
486
487 storm::dd::Add<DdType, ValueType> lowerChoiceAsAdd = choice.template toAdd<ValueType>();
488 for (auto const& successorValuePair : lowerChoiceAsAdd) {
489 uint_fast64_t updateIndex = this->decodeAux(successorValuePair.first, 0, this->getAuxVariableCount());
490
491 storm::storage::BitVector successor(this->getNumberOfPredicates());
492 for (uint_fast64_t index = 0; index < this->getOrderedSuccessorPredicateVariables().size(); ++index) {
493 auto const& successorVariable = this->getOrderedSuccessorPredicateVariables()[index];
494 if (successorValuePair.first.getBooleanValue(successorVariable)) {
495 successor.set(index);
496 }
497 }
498
499 result[updateIndex] = std::make_pair(successor, successorValuePair.second);
500 }
501 return result;
502}
503
504template<storm::dd::DdType DdType>
505template<typename ValueType>
506std::vector<std::map<uint_fast64_t, std::pair<storm::storage::BitVector, ValueType>>> AbstractionInformation<DdType>::decodeChoicesToUpdateSuccessorMapping(
507 std::set<storm::expressions::Variable> const& player2Variables, storm::dd::Bdd<DdType> const& choices) const {
508 std::vector<storm::dd::Bdd<DdType>> splitChoices = choices.split(player2Variables);
509
510 std::vector<std::map<uint_fast64_t, std::pair<storm::storage::BitVector, ValueType>>> result;
511 for (auto const& choice : splitChoices) {
512 result.emplace_back(this->decodeChoiceToUpdateSuccessorMapping<ValueType>(choice));
513 }
514
515 return result;
516}
517
518template<storm::dd::DdType DdType>
519std::tuple<storm::storage::BitVector, uint64_t, uint64_t> AbstractionInformation<DdType>::decodeStatePlayer1ChoiceAndUpdate(
520 storm::dd::Bdd<DdType> const& stateChoiceAndUpdate) const {
521 STORM_LOG_ASSERT(stateChoiceAndUpdate.getNonZeroCount() == 1, "Wrong number of non-zero entries.");
522
523 storm::storage::BitVector statePredicates(this->getNumberOfPredicates());
524
525 storm::dd::Add<DdType, double> add = stateChoiceAndUpdate.template toAdd<double>();
526 auto it = add.begin();
527 auto stateValuePair = *it;
528 uint64_t choiceIndex = this->decodePlayer1Choice(stateValuePair.first, this->getPlayer1VariableCount());
529 uint64_t updateIndex = this->decodeAux(stateValuePair.first, 0, this->getAuxVariableCount());
530 for (uint_fast64_t index = 0; index < this->getOrderedSourcePredicateVariables().size(); ++index) {
531 auto const& successorVariable = this->getOrderedSourcePredicateVariables()[index];
532
533 if (stateValuePair.first.getBooleanValue(successorVariable)) {
534 statePredicates.set(index);
535 }
536 }
537
538 return std::make_tuple(statePredicates, choiceIndex, updateIndex);
539}
540
541template<storm::dd::DdType DdType>
542std::pair<std::pair<storm::expressions::Variable, storm::expressions::Variable>, uint64_t> AbstractionInformation<DdType>::addLocationVariables(
543 storm::expressions::Variable const& locationExpressionVariable, uint64_t highestLocationIndex) {
544 auto newMetaVariable = ddManager->addMetaVariable("loc_" + std::to_string(locationVariablePairs.size()), 0, highestLocationIndex);
545
546 locationExpressionVariables.insert(locationExpressionVariable);
547 locationExpressionToDdVariableMap.emplace(locationExpressionVariable, newMetaVariable);
548 locationVariablePairs.emplace_back(newMetaVariable);
549 allSourceLocationVariables.insert(newMetaVariable.first);
550 sourceVariables.insert(newMetaVariable.first);
551 allSuccessorLocationVariables.insert(newMetaVariable.second);
552 successorVariables.insert(newMetaVariable.second);
553 extendedPredicateDdVariables.emplace_back(newMetaVariable);
554 allLocationIdentities &= ddManager->getIdentity(newMetaVariable.first, newMetaVariable.second);
555 return std::make_pair(locationVariablePairs.back(), locationVariablePairs.size() - 1);
556}
557
558template<storm::dd::DdType DdType>
560 if (source) {
561 return locationVariablePairs[locationVariableIndex].first;
562 } else {
563 return locationVariablePairs[locationVariableIndex].second;
564 }
565}
566
567template<storm::dd::DdType DdType>
568std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSourceLocationVariables() const {
569 return allSourceLocationVariables;
570}
571
572template<storm::dd::DdType DdType>
573std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getSuccessorLocationVariables() const {
574 return allSuccessorLocationVariables;
575}
576
577template<storm::dd::DdType DdType>
579 bool source) {
580 auto const& metaVariablePair = locationExpressionToDdVariableMap.at(locationExpressionVariable);
581 if (source) {
582 return metaVariablePair.first;
583 } else {
584 return metaVariablePair.second;
585 }
586}
587
588template<storm::dd::DdType DdType>
590 uint64_t result = 0;
591 for (auto const& locationVariableToMetaVariablePair : locationExpressionToDdVariableMap) {
592 result += ddManager->getMetaVariable(locationVariableToMetaVariablePair.second.first).getNumberOfDdVariables();
593 }
594 return result;
595}
596
597template<storm::dd::DdType DdType>
598std::set<storm::expressions::Variable> const& AbstractionInformation<DdType>::getLocationExpressionVariables() const {
599 return locationExpressionVariables;
600}
601
602template<storm::dd::DdType DdType>
604 return this->getDdManager().getEncoding(locationVariable, locationIndex);
605}
606
609
610template std::map<uint_fast64_t, std::pair<storm::storage::BitVector, double>>
612template std::map<uint_fast64_t, std::pair<storm::storage::BitVector, double>>
614template std::map<uint_fast64_t, std::pair<storm::storage::BitVector, storm::RationalNumber>>
616
617template std::vector<std::map<uint_fast64_t, std::pair<storm::storage::BitVector, double>>>
618AbstractionInformation<storm::dd::DdType::CUDD>::decodeChoicesToUpdateSuccessorMapping(std::set<storm::expressions::Variable> const& player2Variables,
619 storm::dd::Bdd<storm::dd::DdType::CUDD> const& choices) const;
620template std::vector<std::map<uint_fast64_t, std::pair<storm::storage::BitVector, double>>>
621AbstractionInformation<storm::dd::DdType::Sylvan>::decodeChoicesToUpdateSuccessorMapping(std::set<storm::expressions::Variable> const& player2Variables,
622 storm::dd::Bdd<storm::dd::DdType::Sylvan> const& choices) const;
623template std::vector<std::map<uint_fast64_t, std::pair<storm::storage::BitVector, storm::RationalNumber>>>
624AbstractionInformation<storm::dd::DdType::Sylvan>::decodeChoicesToUpdateSuccessorMapping(std::set<storm::expressions::Variable> const& player2Variables,
625 storm::dd::Bdd<storm::dd::DdType::Sylvan> const& choices) const;
626} // namespace abstraction
627} // 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:1149
bool isZero() const
Retrieves whether this DD represents the constant zero function.
Definition Bdd.cpp:547
virtual uint_fast64_t getNonZeroCount() const override
Retrieves the number of encodings that are mapped to a non-zero value.
Definition Bdd.cpp:513
static Bdd< LibraryType > getEncoding(DdManager< LibraryType > const &ddManager, uint64_t targetOffset, storm::dd::Odd const &odd, std::set< storm::expressions::Variable > const &metaVariables)
Constructs the BDD representation of the encoding with the given offset.
Definition Bdd.cpp:94
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:473
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:16
virtual bool getBooleanValue(Variable const &booleanVariable) const =0
Retrieves the value of the given boolean variable.
std::set< storm::expressions::Variable > const & getSourceLocationVariables() const
Retrieves the source location 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.
void addExpressionVariable(storm::expressions::Variable const &variable)
Adds the given variable.
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...
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::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 > > 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.
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...
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::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::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...
std::set< storm::expressions::Variable > const & getSuccessorLocationVariables() const
Retrieves the source location variables.
uint64_t getNumberOfDdSourceLocationVariables() const
Retrieves the number of DD variables associated with the source location variables.
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...
void addConstraint(storm::expressions::Expression const &constraint)
Adds an expression that constrains the legal variable values.
std::vector< storm::expressions::Expression > const & getPredicates() const
Retrieves all currently known predicates.
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.
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.
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::set< storm::expressions::Variable > const & getSuccessorVariables() const
Retrieves the set of successor meta variables.
storm::dd::DdManager< DdType > & getDdManager()
Retrieves the DD manager.
AbstractionInformation(storm::expressions::ExpressionManager &expressionManager, std::set< storm::expressions::Variable > const &abstractedVariables, std::unique_ptr< storm::solver::SmtSolver > &&smtSolver, AbstractionInformationOptions const &options=AbstractionInformationOptions(), std::shared_ptr< storm::dd::DdManager< DdType > > ddManager=std::make_shared< storm::dd::DdManager< DdType > >())
Creates a new abstraction information object.
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::vector< uint_fast64_t > addPredicates(std::vector< storm::expressions::Expression > const &predicates)
Adds the given predicates.
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.
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:18
void set(uint_fast64_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:23
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30