Closed akihirosasaki closed 6 years ago
Does this routine work with a_indices
containing elements equal to 0
? I would think this would cause out of bounds indexing errors
@sglyon Good point.
Now looking into the ddp
code, a_indices
is actually not used as action "indices" (apart from your newly added conversion routines in the Python version), but rather it can be used as action "values" (as long as they are sorted). (Apparently I wasn't really understanding the logic when I was writing the initial Python version...)
There are two alternatives:
a_indices
to a_values
. For to_product_form
, raise an error if not np.array_equal(self.a_values, np.arange(self.a_values.max())
.a_indices
as is, and (implicitly or explicitly) let the advanced user use it as action values.(I would vote for alternative 2, as it involves no costs...)
Hmm, are you certain that they aren't used as indices? From these lines it looks like the Julia version uses them as indices when constructing a sparse matrix
You are right (and in these lines in the Python version). But these lines are not reached if _has_sorted_sa_indices
is true (so the qualification "as long as they are sorted").
julia translation ddp_ex_MF_7_6_4_py