#include "src/modelchecker/exploration/Bounds.h" #include "src/modelchecker/exploration/ExplorationInformation.h" namespace storm { namespace modelchecker { namespace exploration_detail { template std::pair Bounds::getBoundsForState(StateType const& state, ExplorationInformation const& explorationInformation) const { ActionType index = explorationInformation.getRowGroup(state); if (index == explorationInformation.getUnexploredMarker()) { return std::make_pair(storm::utility::zero(), storm::utility::one()); } else { return boundsPerState[index]; } } template std::pair const& Bounds::getBoundsForExploredState(StateType const& state, ExplorationInformation const& explorationInformation) const { ActionType index = explorationInformation.getRowGroup(state); return boundsPerState[index]; } template ValueType Bounds::getLowerBoundForState(StateType const& state, ExplorationInformation const& explorationInformation) const { ActionType index = explorationInformation.getRowGroup(state); if (index == explorationInformation.getUnexploredMarker()) { return storm::utility::zero(); } else { return getLowerBoundForRowGroup(index); } } template ValueType const& Bounds::getLowerBoundForRowGroup(StateType const& rowGroup) const { return boundsPerState[rowGroup].first; } template ValueType Bounds::getUpperBoundForState(StateType const& state, ExplorationInformation const& explorationInformation) const { ActionType index = explorationInformation.getRowGroup(state); if (index == explorationInformation.getUnexploredMarker()) { return storm::utility::one(); } else { return getUpperBoundForRowGroup(index); } } template ValueType const& Bounds::getUpperBoundForRowGroup(StateType const& rowGroup) const { return boundsPerState[rowGroup].second; } template std::pair const& Bounds::getBoundsForAction(ActionType const& action) const { return boundsPerAction[action]; } template ValueType const& Bounds::getLowerBoundForAction(ActionType const& action) const { return boundsPerAction[action].first; } template ValueType const& Bounds::getUpperBoundForAction(ActionType const& action) const { return boundsPerAction[action].second; } template ValueType const& Bounds::getBoundForAction(storm::OptimizationDirection const& direction, ActionType const& action) const { if (direction == storm::OptimizationDirection::Maximize) { return getUpperBoundForAction(action); } else { return getLowerBoundForAction(action); } } template ValueType Bounds::getDifferenceOfStateBounds(StateType const& state, ExplorationInformation const& explorationInformation) const { std::pair const& bounds = getBoundsForExploredState(state, explorationInformation); return bounds.second - bounds.first; } template void Bounds::initializeBoundsForNextState(std::pair const& vals) { boundsPerState.push_back(vals); } template void Bounds::initializeBoundsForNextAction(std::pair const& vals) { boundsPerAction.push_back(vals); } template void Bounds::setLowerBoundForState(StateType const& state, ExplorationInformation const& explorationInformation, ValueType const& value) { setLowerBoundForRowGroup(explorationInformation.getRowGroup(state), value); } template void Bounds::setLowerBoundForRowGroup(StateType const& group, ValueType const& value) { boundsPerState[group].first = value; } template void Bounds::setUpperBoundForState(StateType const& state, ExplorationInformation const& explorationInformation, ValueType const& value) { setUpperBoundForRowGroup(explorationInformation.getRowGroup(state), value); } template void Bounds::setUpperBoundForRowGroup(StateType const& group, ValueType const& value) { boundsPerState[group].second = value; } template void Bounds::setBoundsForAction(ActionType const& action, std::pair const& values) { boundsPerAction[action] = values; } template void Bounds::setBoundsForState(StateType const& state, ExplorationInformation const& explorationInformation, std::pair const& values) { StateType const& rowGroup = explorationInformation.getRowGroup(state); setBoundsForRowGroup(rowGroup, values); } template void Bounds::setBoundsForRowGroup(StateType const& rowGroup, std::pair const& values) { boundsPerState[rowGroup] = values; } template bool Bounds::setLowerBoundOfStateIfGreaterThanOld(StateType const& state, ExplorationInformation const& explorationInformation, ValueType const& newLowerValue) { StateType const& rowGroup = explorationInformation.getRowGroup(state); if (boundsPerState[rowGroup].first < newLowerValue) { boundsPerState[rowGroup].first = newLowerValue; return true; } return false; } template bool Bounds::setUpperBoundOfStateIfLessThanOld(StateType const& state, ExplorationInformation const& explorationInformation, ValueType const& newUpperValue) { StateType const& rowGroup = explorationInformation.getRowGroup(state); if (newUpperValue < boundsPerState[rowGroup].second) { boundsPerState[rowGroup].second = newUpperValue; return true; } return false; } template class Bounds; } } }