Skip to content
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

Last activation is not executed #11

Open
grizonic opened this issue Nov 3, 2019 · 2 comments
Open

Last activation is not executed #11

grizonic opened this issue Nov 3, 2019 · 2 comments
Assignees

Comments

@grizonic
Copy link

grizonic commented Nov 3, 2019

The last activation on the Greetings example from the docs is not executed. So, when ask_name is executed, ask_location is not and vice-versa. Therefore, greet is never executed. I saw that you had a similar issue (#7 ) that is supposedly fixed, but I think this might be a similar thing.

I noticed that if salience is set, then this just works fine. When not set, the Activations' keys are the same and that's why the second activation is removed from the list when _update_agenda is called after the first activation is fired.

I'm currently using the latest code of the develop branch. This is the Greeting code I'm using:

from experta import *

class Greetings(KnowledgeEngine):
    @DefFacts()
    def _initial_action(self):
        yield Fact(action="greet")

    @Rule(Fact(action='greet'),
          NOT(Fact(name=W())))
    def ask_name(self):
        self.declare(Fact(name=input("What's your name? ")))

    @Rule(Fact(action='greet'),
          NOT(Fact(location=W())))
    def ask_location(self):
        self.declare(Fact(location=input("Where are you? ")))

    @Rule(Fact(action='greet'),
          Fact(name=MATCH.name),
          Fact(location=MATCH.location))
    def greet(self, name, location):
        print("Hi %s! How is the weather in %s?" % (name, location))

engine = Greetings()
engine.reset()  # Prepare the engine for the execution.
engine.run()  # Run it!
@nilp0inter
Copy link
Owner

Thank you for reporting this. I will check it next week.

@nilp0inter nilp0inter self-assigned this Nov 4, 2019
@nilp0inter
Copy link
Owner

Hi! Release 1.9.3 should fix this issue. Could you give it a test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants