-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Result will be arbitrary when only NOT is in the rule #10
Comments
I think I'm running into similar issues with a different example - the greet example of the docs. I noticed that if I explicitly set priority via salience, then there are no issues. If not, I run into issues on both examples. In the greet example I managed to find that activations are being wrongly removed from the list in the _update_agenda method in strategies.py, because the keys seem to be the same for different activations (when salience not specified!). Basically, I see that the location question is popped from the list to be fired and then _update_agenda removes the name question from the list, mistakenly. Also, I didn't manage to understand why it is popping activations and then deleting them in the _update_agenda. I'm sure there's a reason for that, but I can't see it. Commenting out the del statement in _update_agenda makes the greet example work fine as well. Let me know if you think that they are different issues. I can create another one. I'll leave the greet code here, as it might be helpful:
|
I just installed directly from github now (was running 1.9.2 installed with pip) and the bug @orenwangtencent reported has been fixed. I can't reproduce it anymore and I see that the activations' keys are now different :) I will check the greetings example again and if I find something I'll report on a different issue. |
Oh thank u a lot, @grizonic . I tried to install from the develop branch of the GitHub, yet still no luck. But assigning a randint for salience definitely do the trick. I am trying to figure out the activation keys now! |
HI! Sorry for the delay and thank you for reporting this. I am working on it and will be fix soon. |
I've just published v1.9.4, the random behavior should be fixed now. Please check if this works for you. On the other hand, the new tests that I wrote to fix this issue arose two new issues #12 and #13. #12 in particular causes that the order of execution between runs can be undefined when the strategy doesn't have strict rules. This will be the case for example with your code if you remove the declare statement. If you do so both rules will match but with the current implementation the order in which red_light and yellow_light get run can be different between different executions of the Python interpreter. |
Yeah it worked normally now, both the example above and my own code. @nilp0inter thx very much! BTW Really Good library, to learn from and integrate into projects. |
Glad to hear that! Thank you both @orenwangtencent and @grizonic . |
You can just keep running the code below, the result will be arbitrary, which is wierd.
The text was updated successfully, but these errors were encountered: