Jump to content

Archived

This topic is now archived and is closed to further replies.

dalecosp

Inference engine / Rules Processing

Recommended Posts

I'm wanting to do is some lightly dynamic rules processing; an engine receives a widget, examines the widget properties, scans its own ruleset and changes widget properties according to the logic in the rule statement. Does this sound like an inference engine?

 

Does anyone have experience with, suggested reading, or other tidbits to share about such things in PHP?

Share this post


Link to post
Share on other sites

I'm wanting to do is some lightly dynamic rules processing; an engine receives a widget, examines the widget properties, scans its own ruleset and changes widget properties according to the logic in the rule statement. Does this sound like an inference engine?

Not really. An inference engine builds upon existing information. If this thing was supposed to take the ruleset and learn more rules over time then that would qualify. Otherwise... I suppose maybe an expert system? In a slightly more than typical sense of the term.

 

Does anyone have experience with, suggested reading, or other tidbits to share about such things in PHP?

What is "such things"? Your rules processing or inference systems?

Share this post


Link to post
Share on other sites

Thank you very much for your reply. :)

 

What is "such things"? Your rules processing or inference systems?

I suppose you have me. I don't *know* that this system would have to learn on its own (other parts of the system that are currently in existence I tend to view that way, though).

Essentially what I have is this:

 

General_Steps.png

The system is in production and mostly automated, but the "Verify" stage combines human intervention and automation.  Obviously we'd like to decrease the amount of human intervention required.

 

What is desired is for the humans to be able to put "rules" into the system without knowledge of code, and have the system process the data flow using said rules without further human interaction.  So, the system would have to store these rules (DB, no issues there), but I'm not too sure about the overall design and implementation of this idea.  What would you call this?  I'm not sure what to study ;-)

Share this post


Link to post
Share on other sites

Can you give an example of said rules? And how will these rules be defined? Can a programmer intervene to program said rules and does the end-user merely be able to 'chain' these rules?

 

If this is true then the answer is the Specification Pattern:

http://en.wikipedia.org/wiki/Specification_pattern

 

Or something like:

http://symfony.com/doc/current/components/expression_language/syntax.html

Share this post


Link to post
Share on other sites

Thank you, Ignace. I want the rules to be introduced into the system via the UI.

 

An example rule might be:

IF product_make = "Ford" and seller_id = 12345 THEN MODIFY product_category TO 'Truck'
OR

 

IF product_make = "Google" and product_model = "Glass" THEN UNSET product_color
I'm getting a handle on what I *think* I need to do; I'm just not sure if I'm doing it The Best Way. ;)

 

The reading I've done this morning has been helpful, at least, in terms of inspiration, if not actually learning anything (didn't sleep *too* well last evening, alas)....

Share this post


Link to post
Share on other sites

Well you could achieve that using the ExpressionLanguage component and short-circuit logic:

 

(product.makeEquals('Ford') and seller.idEquals(12345)) and product.changeCategory('Truck')
Or using ternary operators:

 

(product.makeEquals('Google') and product.modelEquals('Glass')) ? product.removeColor()
But this assumes your use-case won't get complexer than this and someone with some programming background is around to write these rules.

 

Not to mention that if there is someone with a programming background around he could aswell simply write it in PHP. You don't want your business logic in your database.

Share this post


Link to post
Share on other sites

Oh, but I do, because I've no idea how many rules the operators will want to add (so I guess "complexer" than this is something of a given).

 

The point is that I'm writing generic PHP to handle as many rules as they want to create. Since the system will have to remember these rules, a DB seems better than a text file, no?

 

I'm making some progress. I'll update you if I discover anything remarkable.

 

Thanks again for your help!

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.