diff --git a/prism/src/strat/MDStrategy.java b/prism/src/strat/MDStrategy.java index 2dd80fd9..648a140b 100644 --- a/prism/src/strat/MDStrategy.java +++ b/prism/src/strat/MDStrategy.java @@ -34,6 +34,11 @@ import prism.PrismLog; */ public abstract class MDStrategy implements Strategy { + /** + * Current state of model + */ + protected int currentState = -1; + /** * Get the number of states of the model associated with this strategy. */ @@ -56,6 +61,26 @@ public abstract class MDStrategy implements Strategy */ public abstract Object getChoiceAction(int s); + // Methods for Strategy + + @Override + public void initialise(int s) + { + currentState = s; + } + + @Override + public void update(int action, int s) + { + currentState = s; + } + + @Override + public Object getChoiceAction() + { + return getChoiceAction(currentState); + } + @Override public void exportActions(PrismLog out) { diff --git a/prism/src/strat/Strategy.java b/prism/src/strat/Strategy.java index 70ab973f..c7b6f671 100644 --- a/prism/src/strat/Strategy.java +++ b/prism/src/strat/Strategy.java @@ -44,6 +44,24 @@ public interface Strategy */ public void exportActions(PrismLog out); + /** + * Initialise the strategy, based on an initial model state. + * @param s Initial state of the model + */ + public void initialise(int s); + + /** + * Update the strategy, based on the next step in a model's history. + * @param action The action taken in the previous state of the model + * @param s The new state of the model + */ + public void update(int action, int s); + + /** + * Get the action chosen by the strategy in the current state (assuming it is deterministic). + */ + public Object getChoiceAction(); + /** * Clear storage of the strategy. */