Implementing the Rete-algorithm in Python.

Carrying on with my Rule Engine experiment; the next thing to do is to implement the Rete algorithm. Rete should speed up my implementation quite a bit.

To my knowledge there's only one other implementation of Rete in Python and that is pychinko which is written as a CWM clone (it uses n3 notation to express rules). I guess it could be used for any type of program in most types of environments but it's really got a strong semantic web-feel to it so I'm not sure I'll be able to build on it (also I have no idea what license they're using).

I'm hoping to make an implementation which can be used as an external reasoning engine for other Python programs. I want it to be able to work with any type of Python object and that rules can be expressed using regular Python syntax (or as close to it as possible). I'm also hoping to be able to add backward chaining and maybe have it implemented as a separate object space in the pypy-project.

2 kommentarer:

cs sa...

What is your current status for this?

Johan Lindberg sa...

Well, the situation is a bit complex ;-)

The latest code is not available (and it's not working either) because the last thing I did before getting swamped at work was ripping out the rule compiler which is the part of the application that converts a python function into a Rete network. I'm about halfway thru having a replacement but, as I said, there's not that much free time to do this in.

Also, I have sort of prioritized this a bit lower for me personally because the whole idea was to make an implementation in order to better understand the rete algorithm and I've sort of achieved that goal. I'm quite willing to re-think my prioritization if there's someone that would actually use the application. But up until now it's mostly been a playground for me.

If you're interested in looking at the code or if you have more questions, send me an e-mail.