Closed Hororohoruru closed 1 year ago
I’m not exactly sure. Can you check if the observation probabilities sum to 1 using the new model?
I just checked, it does add up to 1:
decision = BCIAction(2)
next_state = BCIState(3)
obs_model = vep_problem.agent.observation_model
all_observations = obs_model.get_all_observations()
obs_p = [obs_model.probability(obs, next_state, decision) for obs in all_observations]
print(obs_p)
>[0.08333333333333333,
0.08333333333333333,
0.08333333333333333,
0.08333333333333333,
0.08333333333333333,
0.08333333333333333,
0.08333333333333333,
0.08333333333333333,
0.08333333333333333,
0.08333333333333333,
0.08333333333333333,
0.08333333333333333]
print(sum(obs_p))
> 1.0
In that case, I’m not really sure. I’ve also run into cases where a small change caused the sarsop solver to not run.
I personally don’t understand the error message. If I am debugging this, I would start by looking at what min_ratio means.
I personally don't know any C++ in order to check the error myself, so I am stuck...
It is possible that this is a numerical error.
Looking at the source code in sarsop where this error is produced, it's ok if min_ratio is slightly bigger than 1 (tolerance 1e-10
). But in the output you posted, min_ratio is bigger than 1 by 4.00002e-06
, which to me is pretty small as well. It could be that some numerical instability issue happened on the python side -- that is in fact quite likely because all your probabilities are 0.833333333333. So when the .pomdpx file gets generated, maybe the text version of the float chops off a few decimals which causes the numerical instability.
When a POMDP agent in pomdp_py gets converted into a .pomdpx file for sarsop, this function gets called that writes the file. You can see that floats are converted to string via %f
, which prints only six digits by default. To me, this feels pretty suspicious as the source of error -- as a temporary fix, if you can change the string formatting to allow more digits (for example %.9f
would be 9 digits), the problem you're facing might go away.
Yeah, I was looking at the source code or sarsop and found that the MIN_RARIO_EPS to be defined as 1e-10
. I changed it to 1e-4
and it worked. I will try your suggestion as well. Thanks!
I wouldn't change the source code of the solver, unless you really know what you're doing. You don't want to introduce potential bugs.
True! I forked the repo to change the precision of the float to str conversion of to_pomdp_file
and now everything works. Thanks for your help.
Hello. I have a model using SARSOP that was working until now. Following the discussion we had on #27 , I thought about re-running this model with a small change on the observation model's
probability()
function. The old function was:And I changed it to:
Then, when I try to compute the SARSOP policy, I get:
What may be the cause of this?