STORM_LOG_THROW(!input.properties.empty(),storm::exceptions::InvalidArgumentException,"Can not translate properties to multi-objective formula because no properties were specified.");
STORM_LOG_WARN_COND(prop.getFilter().isDefault(),"Non-default property filter of property "+prop.getName()+" will be dropped during conversion to multi-objective property.");
STORM_LOG_THROW(!bound.containsVariables(),storm::exceptions::InvalidOperationException,"Cannot evaluate time-bound '"<<bound<<"' as it contains undefined constants.");
STORM_LOG_THROW(rewardAnalysis.rewardFinitenessType!=preprocessing::RewardFinitenessType::Infinite,storm::exceptions::NotSupportedException,"TThere is no Pareto optimal scheduler that yields finite reward for all objectives. This is not supported.");
STORM_LOG_THROW(rewardAnalysis.rewardLessInfinityEStates,storm::exceptions::UnexpectedException,"The set of states with reward < infinity for some scheduler has not been computed during preprocessing.");
STORM_LOG_THROW(rewardAnalysis.totalRewardLessInfinityEStates,storm::exceptions::UnexpectedException,"The set of states with reward < infinity for some scheduler has not been computed during preprocessing.");
STORM_LOG_THROW(preprocessorResult.containsOnlyTrivialObjectives(),storm::exceptions::NotSupportedException,"At least one objective was not reduced to an expected (total or cumulative) reward objective during preprocessing. This is not supported by the considered weight vector checker.");
STORM_LOG_THROW(preprocessorResult.preprocessedModel->getInitialStates().getNumberOfSetBits()==1,storm::exceptions::NotSupportedException,"The model has multiple initial states.");
// Build a subsystem of the preprocessor result model that discards states that yield infinite reward for all schedulers.
// We can also merge the states that will have reward zero anyway.
STORM_LOG_THROW(formula.isRewardOperatorFormula()&&formula.asRewardOperatorFormula().hasRewardModelName(),storm::exceptions::UnexpectedException,"Unexpected type of operator formula: "<<formula);
STORM_LOG_THROW(formula.getSubformula().isCumulativeRewardFormula()&&formula.getSubformula().asCumulativeRewardFormula().getTimeBoundReference().isTimeBound(),storm::exceptions::UnexpectedException,"Unexpected type of sub-formula: "<<formula.getSubformula());
STORM_LOG_THROW(!rewModel.hasStateRewards(),storm::exceptions::InvalidPropertyException,"Found state rewards for time bounded objective "<<this->objectives[objIndex].originalFormula<<". This is not supported.");
STORM_LOG_WARN_COND(this->objectives[objIndex].originalFormula->isProbabilityOperatorFormula()&&this->objectives[objIndex].originalFormula->asProbabilityOperatorFormula().getSubformula().isBoundedUntilFormula(),"Objective "<<this->objectives[objIndex].originalFormula<<" was simplified to a cumulative reward formula. Correctness of the algorithm is unknown for this type of property.");
STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(),storm::exceptions::UncheckedRequirementException,"Solver requirements "+req.getEnabledRequirementsAsString()+" not checked.");
STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(),storm::exceptions::UncheckedRequirementException,"Solver requirements "+req.getEnabledRequirementsAsString()+" not checked.");
STORM_LOG_THROW(!cumulativeRewardFormula.isMultiDimensional()&&!cumulativeRewardFormula.getTimeBoundReference().isRewardBound(),storm::exceptions::UnexpectedException,"Unexpected type of sub-formula: "<<formula.getSubformula());
}else{
STORM_LOG_THROW(formula.getSubformula().isTotalRewardFormula(),storm::exceptions::UnexpectedException,"Unexpected type of sub-formula: "<<formula.getSubformula());
STORM_LOG_THROW(formula.getSubformula().isTotalRewardFormula()||formula.getSubformula().isLongRunAverageRewardFormula(),storm::exceptions::UnexpectedException,"Unexpected type of sub-formula: "<<formula.getSubformula());
STORM_LOG_THROW(rewardAnalysis.rewardFinitenessType!=preprocessing::RewardFinitenessType::Infinite,storm::exceptions::NotSupportedException,"There is no Pareto optimal scheduler that yields finite reward for all objectives. This is not supported.");
STORM_LOG_THROW(rewardAnalysis.rewardLessInfinityEStates,storm::exceptions::UnexpectedException,"The set of states with reward < infinity for some scheduler has not been computed during preprocessing.");
STORM_LOG_THROW(preprocessorResult.containsOnlyTrivialObjectives(),storm::exceptions::NotSupportedException,"At least one objective was not reduced to an expected (total or cumulative) reward objective during preprocessing. This is not supported by the considered weight vector checker.");
STORM_LOG_THROW(rewardAnalysis.totalRewardLessInfinityEStates,storm::exceptions::UnexpectedException,"The set of states with reward < infinity for some scheduler has not been computed during preprocessing.");
STORM_LOG_THROW(preprocessorResult.containsOnlyTrivialObjectives(),storm::exceptions::NotSupportedException,"At least one objective was not reduced to an expected (long run, total or cumulative) reward objective during preprocessing. This is not supported by the considered weight vector checker.");
STORM_LOG_THROW(preprocessorResult.preprocessedModel->getInitialStates().getNumberOfSetBits()==1,storm::exceptions::NotSupportedException,"The model has multiple initial states.");
// Build a subsystem of the preprocessor result model that discards states that yield infinite reward for all schedulers.
// We can also merge the states that will have reward zero anyway.
STORM_LOG_INFO("Invoked WeightVectorChecker with weights "<<std::endl<<"\t"<<storm::utility::vector::toString(storm::utility::vector::convertNumericVector<double>(weightVector)));
// Prepare and invoke weighted infinite horizon (long run average) phase
STORM_LOG_THROW(this->checkHasBeenCalled,storm::exceptions::IllegalFunctionCallException,"Tried to retrieve results but check(..) has not been called before.");
for(autoconst&obj:this->objectives){
STORM_LOG_THROW(obj.formula->getSubformula().isTotalRewardFormula(),storm::exceptions::NotImplementedException,"Scheduler retrival is only implemented for objectives without time-bound.");
STORM_LOG_THROW(obj.formula->getSubformula().isTotalRewardFormula()||obj.formula->getSubformula().isLongRunAverageRewardFormula(),storm::exceptions::NotImplementedException,"Scheduler retrival is only implemented for objectives without time-bound.");
// We also need to assign a value for each ecQuotientChoice that corresponds to "staying" in the eliminated EC. (at this point these choices should all have a value of zero).
// Since each of the eliminated ECs has to contain *at least* one LRA EC, we need to find the largest value among the contained LRA ECs
storm::storage::BitVectorfoundEcqChoices(ecQuotient->matrix.getRowCount(),false);// keeps track of choices we have already seen before
STORM_LOG_ASSERT(ecqChoice<ecQuotient->matrix.getRowGroupIndices()[ecqState+1],"Unable to find choice that represents staying inside the (eliminated) ec.");
// We compute an estimate for the results of the individual objectives which is obtained from the weighted result and the result of the objectives computed so far.
// Note that weightedResult = Sum_{i=1}^{n} w_i * objectiveResult_i.
STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(),storm::exceptions::UncheckedRequirementException,"Solver requirements "+req.getEnabledRequirementsAsString()+" not checked.");
STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(),storm::exceptions::UncheckedRequirementException,"Solver requirements "+req.getEnabledRequirementsAsString()+" not checked.");
// We stay in the current state(s) forever (End component)
// We need to set choices in a way that (i) the optimal LRA Mec is reached (if there is any) and (ii) 0 total reward is collected.
if(!ecqStateToOptimalMecMap.empty()){
// The current ecqState represents an elimnated EC and we need to stay in this EC and we need to make sure that optimal MEC decisions are performed within this EC.
STORM_LOG_ASSERT(ecqStateToOptimalMecMap.count(ecqState)>0,"No Lra Mec associated to given eliminated EC");
STORM_LOG_ASSERT(lraMec.containsState(state),"Expected state to be contained in the lra mec.");
// Note that the optimal choice for this state has already been set in the infinite horizon phase.
unprocessedStates.set(state,false);
originalSolution[state]=ecqSolution[ecqState];
}
}else{
statesWithUndefSched.set(state);
statesThatShouldStayInTheirEC.set(state);
// LRA mec is proper subset of eliminated ec. There are also other states for which we have to set choices leading to the LRA MEC inside.
STORM_LOG_ASSERT(lraMec.size()<origStates.size(),"Lra Mec ("<<lraMec.size()<<" states) should be a proper subset of the eliminated ec ("<<origStates.size()<<" states).");
for(autoconst&state:origStates){
if(lraMec.containsState(state)){
ecStatesToReach.set(state,true);
// Note that the optimal choice for this state has already been set in the infinite horizon phase.
STORM_LOG_ASSERT(storm::utility::isZero(ecqSolution[ecqState]),"Solution for state that stays inside EC must be zero. Got "<<ecqSolution[ecqState]<<" instead.");
for(autoconst&state:origStates){
originalSolution[state]=storm::utility::zero<ValueType>();// i.e. ecqSolution[ecqState];
STORM_LOG_ASSERT(origChoice>=groupStart&&origChoice<transitionMatrix.getRowGroupIndices()[state+1],"Invalid choice: "<<originalOptimalChoices[state]<<" at a state with "<<transitionMatrix.getRowGroupSize(state)<<" choices.");
STORM_LOG_THROW(false,storm::exceptions::InvalidPropertyException,"Could not preprocess the subformula "<<*opFormula<<" of "<<originalFormula<<" because it is not supported");
STORM_LOG_THROW(false,storm::exceptions::InvalidPropertyException,"The formula "<<formula<<" neither considers reachability probabilities nor reachability rewards "<<(data.model->isOfType(storm::models::ModelType::MarkovAutomaton)?"nor reachability time":"")<<". This is not supported.");
STORM_LOG_THROW(data.model->isOfType(storm::models::ModelType::Mdp),storm::exceptions::InvalidPropertyException,"Cumulative reward formulas are not supported for the given model type.");
STORM_LOG_WARN_COND(obj.formula->getSubformula().isTotalRewardFormula()||obj.formula->getSubformula().isCumulativeRewardFormula(),"Analyzing reachability reward formulas is not supported properly.");
STORM_LOG_WARN_COND(obj.formula->getSubformula().isCumulativeRewardFormula(),"Analyzing subformula "<<obj.formula->getSubformula()<<" is not supported properly.");
.addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("instance-index","The selected instance of this model.").setDefaultValueUnsignedInteger(0).makeOptional().build())
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filter","The comma separated list of property names to check. Omit to check all, \"\" to check none.").setDefaultValueString("").makeOptional().build())
.build());
this->addOption(storm::settings::OptionBuilder(moduleName,propertiesAsMultiOptionName,false,"If set, the selected properties are interpreted as a multi-objective formula.").setIsAdvanced().build());
STORM_LOG_ASSERT(result.newToOldRowMapping.size()<originalMatrix.getRowCount(),"Didn't expect to see more rows in the reduced matrix than in the original one.");
STORM_LOG_THROW(subsubFormula.isTotalRewardFormula()||subsubFormula.isCumulativeRewardFormula(),storm::exceptions::NotSupportedException,"The given Formula "<<subsubFormula<<" is not supported.");
STORM_LOG_THROW(subFormula->isLongRunAverageOperatorFormula()||subsubFormula.isTotalRewardFormula()||subsubFormula.isCumulativeRewardFormula()||subsubFormula.isLongRunAverageRewardFormula(),storm::exceptions::NotSupportedException,"The given Formula "<<subsubFormula<<" is not supported.");
STORM_LOG_THROW(isDiscreteTimeModel||!acc.isExitSet()||!baseRewardModel.hasStateRewards(),storm::exceptions::NotSupportedException,"Exit rewards for continuous time models are not supported.");
STORM_LOG_THROW(isDiscreteTimeModel||!acc.isExitSet()||!baseRewardModel.hasStateRewards(),storm::exceptions::NotSupportedException,"Exit rewards for continuous time models are not supported.");
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
// TODO: Right now, there is a non-optimal point included due to numerical imprecisions. We therefore skip this check:
//EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(), convertPointset<double>(expectedPoints), eps)) << "Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
}
}
#endif /* defined STORM_HAVE_HYPRO || defined STORM_HAVE_Z3_OPTIMIZE */
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(),convertPointset<double>(expectedPoints),eps))<<"Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
// TODO: Right now, there is a non-optimal point included due to numerical imprecisions. We therefore skip this check:
// EXPECT_TRUE(expectSubset(result->asExplicitParetoCurveCheckResult<double>().getPoints(), convertPointset<double>(expectedPoints), eps)) << "Non-Pareto point found.";
EXPECT_TRUE(expectSubset(convertPointset<double>(expectedPoints),result->asExplicitParetoCurveCheckResult<double>().getPoints(),eps))<<"Pareto point missing.";
}
}
#endif /* STORM_HAVE_HYPRO || defined STORM_HAVE_Z3_OPTIMIZE */