From d52576a6dd2a1f934617952ff86eb6245de92a78 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Mon, 16 Nov 2015 11:07:03 +0000 Subject: [PATCH] Refactoring + tidying in multi-objective value iteration. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@10884 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/sparse/PS_NondetMultiObj.cc | 15 ++++++++------- prism/src/sparse/PS_NondetMultiObjGS.cc | 17 ++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/prism/src/sparse/PS_NondetMultiObj.cc b/prism/src/sparse/PS_NondetMultiObj.cc index 43d66566..1f789e98 100644 --- a/prism/src/sparse/PS_NondetMultiObj.cc +++ b/prism/src/sparse/PS_NondetMultiObj.cc @@ -443,19 +443,20 @@ JNIEXPORT jdoubleArray __jlongpointer JNICALL Java_sparse_PrismSparse_PS_1Nondet first = false; } + // HOTFIX: it seems that on self loops d1 can be unchanged because the other for cycle is not executed, which is not desirable + if (d1 == -INFINITY) { + d1 = 0; + for (int it = 0; it < lenRew + lenProb; it++) { + pd1[it] = 0; + } + } + double val_yes = 0.0; for (int probi = 0; probi < lenProb; probi++) { if (max_iters_local - iters < step_bounds[probi]) val_yes += weights[probi] * yes_vec[probi][i]; } - //HOTFIX: it seems that on self loops d1 can be unchanged because the other for cycle is not executed, which is not desirable - if (d1==-INFINITY) { - d1 = 0; - for (int it = 0; it < lenRew + lenProb; it++) - pd1[it] = 0; - } - //TODO: we need to handle val_yes somehow if (val_yes == 0 || d1>val_yes) { for (int it = 0; it < lenProb + lenRew; it++) { diff --git a/prism/src/sparse/PS_NondetMultiObjGS.cc b/prism/src/sparse/PS_NondetMultiObjGS.cc index 782220ac..54cc30f0 100644 --- a/prism/src/sparse/PS_NondetMultiObjGS.cc +++ b/prism/src/sparse/PS_NondetMultiObjGS.cc @@ -336,7 +336,6 @@ JNIEXPORT jdoubleArray __jlongpointer JNICALL Java_sparse_PrismSparse_PS_1Nondet } // see if the combined reward value is the min/max so far bool pickThis = first || (min&&(d2d1)); - //HOTFIX for cumulative reward if (!pickThis && (d2==d1)) { for (int it = 0; it < lenProb + lenRew; it++) { @@ -367,20 +366,20 @@ JNIEXPORT jdoubleArray __jlongpointer JNICALL Java_sparse_PrismSparse_PS_1Nondet first = false; } + // HOTFIX: it seems that on self loops d1 can be unchanged because the other for cycle is not executed, which is not desirable + if (d1 == -INFINITY) { + d1 = 0; + for (int it = 0; it < lenRew + lenProb; it++) { + pd1[it] = 0; + } + } + double val_yes = 0.0; for (int probi = 0; probi < lenProb; probi++) { if (probi != ignoredWeight && yes_vec[probi]!=NULL); val_yes += weights[probi] * yes_vec[probi][i]; } - - //HOTFIX: it seems that on self loops d1 can be unchanged because the other for cycle is not executed, which is not desirable - if (d1==-INFINITY) { - d1 = 0; - for (int it = 0; it < lenRew + lenProb; it++) - pd1[it] = 0; - } - //TODO: we need to handle val_yes somehow if (val_yes == 0 || d1>val_yes) {