A ValueError occurs whenever an infinity or NaN (i.e. divide by zero) is detected in your observations or rewards. These are not allowed because infinity and NaN are uncomputable numbers.

1. Run a Monte Carlo for 100 iterations.

To test if your simulation contains invalid values, run a Monte Carlo for 100 iterations. Pathmind will automatically raise an error if an infinity or NaN is detected in your observations or rewards.

2. Add a check for infinity or NaN values in PathmindHelper.

To fix the problem, add a check for infinity or NaN values. In the code below, the reward is set to 0 if an infinity or NaN is detected.

Did this answer your question?