diff --git a/prism/src/explicit/MDPSimple.java b/prism/src/explicit/MDPSimple.java index c657022a..d6288d5a 100644 --- a/prism/src/explicit/MDPSimple.java +++ b/prism/src/explicit/MDPSimple.java @@ -874,8 +874,10 @@ public class MDPSimple extends MDPExplicit implements NondetModelSimple minmax += mdpRewards.getStateReward(s); // If strategy generation is enabled, store optimal choice if (strat != null & !first) { - // Only remember strictly better choices (required for max) - if (strat[s] == -1 || (min && minmax < vect[s]) || (!min && minmax > vect[s])) { + // For max, only remember strictly better choices + if (min) { + strat[s] = stratCh; + } else if (strat[s] == -1 || minmax > vect[s]) { strat[s] = stratCh; } } @@ -925,8 +927,10 @@ public class MDPSimple extends MDPExplicit implements NondetModelSimple minmax += mdpRewards.getStateReward(s); // If strategy generation is enabled, store optimal choice if (strat != null & !first) { - // Only remember strictly better choices (required for max) - if (strat[s] == -1 || (min && minmax < vect[s]) || (!min && minmax > vect[s])) { + // For max, only remember strictly better choices + if (min) { + strat[s] = stratCh; + } else if (strat[s] == -1 || minmax > vect[s]) { strat[s] = stratCh; } } diff --git a/prism/src/explicit/MDPSparse.java b/prism/src/explicit/MDPSparse.java index 53f3e020..a93bf6fb 100644 --- a/prism/src/explicit/MDPSparse.java +++ b/prism/src/explicit/MDPSparse.java @@ -947,8 +947,10 @@ public class MDPSparse extends MDPExplicit minmax += mdpRewards.getStateReward(s); // If strategy generation is enabled, store optimal choice if (strat != null & !first) { - // Only remember strictly better choices (required for max) - if (strat[s] == -1 || (min && minmax < vect[s]) || (!min && minmax > vect[s])) { + // For max, only remember strictly better choices + if (min) { + strat[s] = stratCh; + } else if (strat[s] == -1 || minmax > vect[s]) { strat[s] = stratCh; } } @@ -995,8 +997,10 @@ public class MDPSparse extends MDPExplicit minmax += mdpRewards.getStateReward(s); // If strategy generation is enabled, store optimal choice if (strat != null & !first) { - // Only remember strictly better choices (required for max) - if (strat[s] == -1 || (min && minmax < vect[s]) || (!min && minmax > vect[s])) { + // For max, only remember strictly better choices + if (min) { + strat[s] = stratCh; + } else if (strat[s] == -1 || minmax > vect[s]) { strat[s] = stratCh; } }