You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.2 KiB
60 lines
2.2 KiB
#include "src/logic/InstantaneousRewardFormula.h"
|
|
|
|
#include "src/logic/FormulaVisitor.h"
|
|
|
|
namespace storm {
|
|
namespace logic {
|
|
InstantaneousRewardFormula::InstantaneousRewardFormula(uint_fast64_t timeBound) : timeBound(timeBound) {
|
|
// Intentionally left empty.
|
|
}
|
|
|
|
InstantaneousRewardFormula::InstantaneousRewardFormula(double timeBound) : timeBound(timeBound) {
|
|
// Intentionally left empty.
|
|
}
|
|
|
|
bool InstantaneousRewardFormula::isInstantaneousRewardFormula() const {
|
|
return true;
|
|
}
|
|
|
|
bool InstantaneousRewardFormula::isRewardPathFormula() const {
|
|
return true;
|
|
}
|
|
|
|
boost::any InstantaneousRewardFormula::accept(FormulaVisitor const& visitor, boost::any const& data) const {
|
|
return visitor.visit(*this, data);
|
|
}
|
|
|
|
bool InstantaneousRewardFormula::hasDiscreteTimeBound() const {
|
|
return timeBound.which() == 0;
|
|
}
|
|
|
|
uint_fast64_t InstantaneousRewardFormula::getDiscreteTimeBound() const {
|
|
return boost::get<uint_fast64_t>(timeBound);
|
|
}
|
|
|
|
bool InstantaneousRewardFormula::hasContinuousTimeBound() const {
|
|
return timeBound.which() == 1;
|
|
}
|
|
|
|
double InstantaneousRewardFormula::getContinuousTimeBound() const {
|
|
if (this->hasDiscreteTimeBound()) {
|
|
return this->getDiscreteTimeBound();
|
|
} else {
|
|
return boost::get<double>(timeBound);
|
|
}
|
|
}
|
|
|
|
std::shared_ptr<Formula> InstantaneousRewardFormula::substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) const {
|
|
return std::make_shared<InstantaneousRewardFormula>(*this);
|
|
}
|
|
|
|
std::ostream& InstantaneousRewardFormula::writeToStream(std::ostream& out) const {
|
|
if (this->hasDiscreteTimeBound()) {
|
|
out << "I=" << this->getDiscreteTimeBound();
|
|
} else {
|
|
out << "I=" << this->getContinuousTimeBound();
|
|
}
|
|
return out;
|
|
}
|
|
}
|
|
}
|