From 6f77b585ec79232007fe62ef16533cd2770750ac Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Thu, 9 Aug 2018 08:14:01 +0200 Subject: [PATCH] sparse.cc: fix build_nd_action_vector() result storage The generated action vector was stored in the 'actions' member of the NDSparseMatrix that was the last one that was built (remembered in the global ndsm pointer variable). Now, we store it in the 'actions' member of the mdp_ndsm that is passed in, as intended. This did not result in problems before because the call to build_nd_action_vector() was always immediately after the corresponding NDSparseMatrix was built. --- prism/src/sparse/sparse.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/prism/src/sparse/sparse.cc b/prism/src/sparse/sparse.cc index e0ec9cb2..48fee5ff 100644 --- a/prism/src/sparse/sparse.cc +++ b/prism/src/sparse/sparse.cc @@ -837,11 +837,11 @@ NDSparseMatrix *build_sub_nd_sparse_matrix(DdManager *ddman, DdNode *mdp, DdNode //------------------------------------------------------------------------------ -// build nondeterministic (mdp) action vector to accompany a sparse matrix +// Build nondeterministic (mdp) action vector to accompany a sparse matrix // (i.e. a vector containing for every state and nondet choice, an index -// into the list of all action labels). store it in the 'actions' field. +// into the list of all action labels). +// Store the resulting vector in the 'actions' member of the passed in NDSparseMatrix. // throws std::bad_alloc on out-of-memory - void build_nd_action_vector(DdManager *ddman, DdNode *mdp, DdNode *trans_actions, NDSparseMatrix *mdp_ndsm, DdNode **rvars, DdNode **cvars, int num_vars, DdNode **ndvars, int num_ndvars, ODDNode *odd) { int i, n, nm, nc; @@ -923,8 +923,8 @@ void build_nd_action_vector(DdManager *ddman, DdNode *mdp, DdNode *trans_actions delete[] matrices; delete[] submatrices; delete[] matrices_bdds; - - ndsm->actions = actions; + + mdp_ndsm->actions = actions; } //------------------------------------------------------------------------------