|
|
@ -1,37 +1,30 @@ |
|
|
|
//
|
|
|
|
// Created by Jip Spel on 03.09.18.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "AssumptionMaker.h"
|
|
|
|
|
|
|
|
namespace storm { |
|
|
|
namespace analysis { |
|
|
|
typedef std::shared_ptr<storm::expressions::BinaryRelationExpression> AssumptionType; |
|
|
|
typedef std::shared_ptr<expressions::BinaryRelationExpression> AssumptionType; |
|
|
|
template<typename ValueType> |
|
|
|
AssumptionMaker<ValueType>::AssumptionMaker(AssumptionChecker<ValueType>* assumptionChecker, uint_fast64_t numberOfStates, bool validate) { |
|
|
|
this->numberOfStates = numberOfStates; |
|
|
|
this->assumptionChecker = assumptionChecker; |
|
|
|
this->validate = validate; |
|
|
|
this->expressionManager = std::make_shared<storm::expressions::ExpressionManager>(storm::expressions::ExpressionManager()); |
|
|
|
this->expressionManager = std::make_shared<expressions::ExpressionManager>(expressions::ExpressionManager()); |
|
|
|
for (uint_fast64_t i = 0; i < this->numberOfStates; ++i) { |
|
|
|
// TODO: expressenmanager pointer maken die oorspronkelijk in monotonicity checker zit
|
|
|
|
expressionManager->declareRationalVariable(std::to_string(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename ValueType> |
|
|
|
std::map<std::shared_ptr<storm::expressions::BinaryRelationExpression>, AssumptionStatus> AssumptionMaker<ValueType>::createAndCheckAssumption(uint_fast64_t val1, uint_fast64_t val2, Lattice* lattice) { |
|
|
|
std::map<std::shared_ptr<storm::expressions::BinaryRelationExpression>, AssumptionStatus> result; |
|
|
|
std::map<std::shared_ptr<expressions::BinaryRelationExpression>, AssumptionStatus> AssumptionMaker<ValueType>::createAndCheckAssumption(uint_fast64_t val1, uint_fast64_t val2, Lattice* lattice) { |
|
|
|
std::map<std::shared_ptr<expressions::BinaryRelationExpression>, AssumptionStatus> result; |
|
|
|
|
|
|
|
// TODO: alleen maar als validate true is results genereren
|
|
|
|
storm::expressions::Variable var1 = expressionManager->getVariable(std::to_string(val1)); |
|
|
|
storm::expressions::Variable var2 = expressionManager->getVariable(std::to_string(val2)); |
|
|
|
std::shared_ptr<storm::expressions::BinaryRelationExpression> assumption1 |
|
|
|
= std::make_shared<storm::expressions::BinaryRelationExpression>(storm::expressions::BinaryRelationExpression(*expressionManager, expressionManager->getBooleanType(), |
|
|
|
expressions::Variable var1 = expressionManager->getVariable(std::to_string(val1)); |
|
|
|
expressions::Variable var2 = expressionManager->getVariable(std::to_string(val2)); |
|
|
|
std::shared_ptr<expressions::BinaryRelationExpression> assumption1 |
|
|
|
= std::make_shared<expressions::BinaryRelationExpression>(expressions::BinaryRelationExpression(*expressionManager, expressionManager->getBooleanType(), |
|
|
|
var1.getExpression().getBaseExpressionPointer(), var2.getExpression().getBaseExpressionPointer(), |
|
|
|
storm::expressions::BinaryRelationExpression::RelationType::Greater)); |
|
|
|
// TODO: dischargen gebasseerd op monotonicity
|
|
|
|
expressions::BinaryRelationExpression::RelationType::Greater)); |
|
|
|
AssumptionStatus result1; |
|
|
|
AssumptionStatus result2; |
|
|
|
AssumptionStatus result3; |
|
|
@ -43,10 +36,10 @@ namespace storm { |
|
|
|
result[assumption1] = result1; |
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<storm::expressions::BinaryRelationExpression> assumption2 |
|
|
|
= std::make_shared<storm::expressions::BinaryRelationExpression>(storm::expressions::BinaryRelationExpression(*expressionManager, expressionManager->getBooleanType(), |
|
|
|
std::shared_ptr<expressions::BinaryRelationExpression> assumption2 |
|
|
|
= std::make_shared<expressions::BinaryRelationExpression>(expressions::BinaryRelationExpression(*expressionManager, expressionManager->getBooleanType(), |
|
|
|
var2.getExpression().getBaseExpressionPointer(), var1.getExpression().getBaseExpressionPointer(), |
|
|
|
storm::expressions::BinaryRelationExpression::RelationType::Greater)); |
|
|
|
expressions::BinaryRelationExpression::RelationType::Greater)); |
|
|
|
|
|
|
|
if (validate) { |
|
|
|
result2 = assumptionChecker->validateAssumption(assumption2, lattice); |
|
|
@ -55,10 +48,10 @@ namespace storm { |
|
|
|
} |
|
|
|
result[assumption2] = result2; |
|
|
|
|
|
|
|
std::shared_ptr<storm::expressions::BinaryRelationExpression> assumption3 |
|
|
|
= std::make_shared<storm::expressions::BinaryRelationExpression>(storm::expressions::BinaryRelationExpression(*expressionManager, expressionManager->getBooleanType(), |
|
|
|
std::shared_ptr<expressions::BinaryRelationExpression> assumption3 |
|
|
|
= std::make_shared<expressions::BinaryRelationExpression>(expressions::BinaryRelationExpression(*expressionManager, expressionManager->getBooleanType(), |
|
|
|
var2.getExpression().getBaseExpressionPointer(), var1.getExpression().getBaseExpressionPointer(), |
|
|
|
storm::expressions::BinaryRelationExpression::RelationType::Equal)); |
|
|
|
expressions::BinaryRelationExpression::RelationType::Equal)); |
|
|
|
if (validate) { |
|
|
|
result3 = assumptionChecker->validateAssumption(assumption3, lattice); |
|
|
|
} else { |
|
|
@ -69,6 +62,6 @@ namespace storm { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
template class AssumptionMaker<storm::RationalFunction>; |
|
|
|
template class AssumptionMaker<RationalFunction>; |
|
|
|
} |
|
|
|
} |