|
|
@ -653,13 +653,20 @@ JNIEXPORT jdoubleArray __jlongpointer JNICALL Java_sparse_PrismSparse_PS_1Nondet |
|
|
ret = env->NewDoubleArray(lenProb + lenRew); |
|
|
ret = env->NewDoubleArray(lenProb + lenRew); |
|
|
jdouble *retNative = env->GetDoubleArrayElements(ret, 0); |
|
|
jdouble *retNative = env->GetDoubleArrayElements(ret, 0); |
|
|
|
|
|
|
|
|
|
|
|
// Display result
|
|
|
|
|
|
PS_PrintToMainLog(env, "Optimal value for weights ["); |
|
|
|
|
|
for (int it = 0; it < lenRew + lenProb; it++) { |
|
|
|
|
|
PS_PrintToMainLog(env, "%s%f", (it>0?",":""), weights[it]); |
|
|
|
|
|
} |
|
|
|
|
|
PS_PrintToMainLog(env, "] from initial state: %f\n", soln[start_index]); |
|
|
|
|
|
|
|
|
//copy all computed elements
|
|
|
//copy all computed elements
|
|
|
for (int it = 0; it < lenRew + lenProb; it++) |
|
|
for (int it = 0; it < lenRew + lenProb; it++) |
|
|
if (it != ignoredWeight) |
|
|
if (it != ignoredWeight) |
|
|
retNative[it] = max_double_vector_over_bdd(ddman, psoln[it], start, rvars, num_rvars, odd); |
|
|
|
|
|
|
|
|
retNative[it] = psoln[it][start_index]; |
|
|
//compute the last element
|
|
|
//compute the last element
|
|
|
if (ignoredWeight != -1) { |
|
|
if (ignoredWeight != -1) { |
|
|
double last = max_double_vector_over_bdd(ddman, soln, start, rvars, num_rvars, odd); |
|
|
|
|
|
|
|
|
double last = soln[start_index]; |
|
|
for (int it = 0; it < lenRew + lenProb; it++) |
|
|
for (int it = 0; it < lenRew + lenProb; it++) |
|
|
if (it != ignoredWeight) |
|
|
if (it != ignoredWeight) |
|
|
last -= weights[it] * retNative[it]; |
|
|
last -= weights[it] * retNative[it]; |
|
|
|