From 6b84e7308e7b66ac131c65bddf67aa7bf50a320a Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Thu, 16 Jul 2020 10:39:36 +0100 Subject: [PATCH] Bugfix in strategy generation for multi-objective value iteration (Pareto curve). Caused by mix of min/max objectives. Reported on forum: https://groups.google.com/d/msgid/prismmodelchecker/fb293745-a8ca-482c-a363-93a71a032c92o%40googlegroups.com?utm_medium=email&utm_source=footer --- prism/src/sparse/PS_NondetMultiObj.cc | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/prism/src/sparse/PS_NondetMultiObj.cc b/prism/src/sparse/PS_NondetMultiObj.cc index a5fe4d97..c3d28f59 100644 --- a/prism/src/sparse/PS_NondetMultiObj.cc +++ b/prism/src/sparse/PS_NondetMultiObj.cc @@ -440,20 +440,13 @@ JNIEXPORT jdoubleArray __jlongpointer JNICALL Java_sparse_PrismSparse_PS_1Nondet if (adv[i] == -1) { adv[i] = j; } else { - // otherwise it depends whether we're doing min or max - // (but sometimes min is max with negative rewards) - bool minAdv = min ? d1>0 : d1<0; - // for max, only remember strictly better choices - // (this resolves problems with end components) - // (note use of absolute values because values may be negative) - if (!minAdv) { - if (fabs(d1)>fabs(soln[i])) { - adv[i] = j; - } - } - // for min, always store the value - // (in fact, could do it at the end of value iteration, but we don't) - else { + // normally, we extract optimal choice differently for max + // (only remember strictly better choices) + // (which resolves problems with end components) + // but here it's hard to know when it is max, due to the + // mix of objectives and some being negated + // so we just always only pick strictly better ones + if ((min&&(d1soln[i]))) { adv[i] = j; } }