From b55493f943e680c4785eb215ff204a2624f73934 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Fri, 5 Aug 2011 09:27:31 +0000 Subject: [PATCH] Method to buld rewards for arbitrary (explicit) models. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@3377 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- .../explicit/rewards/ConstructRewards.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/prism/src/explicit/rewards/ConstructRewards.java b/prism/src/explicit/rewards/ConstructRewards.java index f7622935..6634d0ae 100644 --- a/prism/src/explicit/rewards/ConstructRewards.java +++ b/prism/src/explicit/rewards/ConstructRewards.java @@ -51,6 +51,25 @@ public class ConstructRewards this.mainLog = mainLog; } + /** + * Construct rewards from a model and reward structure. + * @param model The model + * @param rewStr The reward structure + * @param constantValues Values for any undefined constants needed + */ + public Rewards buildRewardStructure(Model model, RewardStruct rewStr, Values constantValues) throws PrismException + { + switch (model.getModelType()) { + case DTMC: + case CTMC: + return buildMCRewardStructure((DTMC) model, rewStr, constantValues); + case MDP: + return buildMDPRewardStructure((MDP) model, rewStr, constantValues); + default: + throw new PrismException("Cannot build rewards for " + model.getModelType() + "s"); + } + } + /** * Construct the rewards for a Markov chain (DTMC or CTMC) from a model and reward structure. * @param mc The DTMC or CTMC