What pattern/patterns work best for developing rule/decision engine [closed]

拈花ヽ惹草 提交于 2019-12-03 03:45:53
stacker

Basically business rules look like

forall rules:
  if <condition> then doAction();

What about categorizing all offences by severity using scores, perhaps extra bonus for frequent "evil-doers", some offences may become time-barred and whatever required.

Then a rough draft of an algorithm could be:

  • Sum of all scores of a customer (weighted)
  • compare to maximum

This would be straight forward using data structures instead of many (possibly deeply nested) if..then..else things.

I can suggest you a tool we used to solve a similar problem.

Take a look at JBoss Drools: http://www.jboss.org/drools/

It's a BRMS: Business Rules Management System

Here it is an introductory video: http://www.jboss.com/products/platforms/brms/

I'm not sure any of the answers above have been that helpful.

I have written similar components using expression trees. You can build lambda expressions that represent predicates, compile and execute them, all dynamically, and then trigger some action in response. This approach is powerful, flexible and strips out all the if/else horror (which is definitely not the way to go).

However, what you are really talking about is logic programming. There are numerous implementations of Prolog over .NET. Prolog is a logic based language, used alot for AI applications, that starts to become seriously powerful once you have your head around its paradigm.

Have a look at some of these ..

You could try something similar to this "event based" rules engine

I think any RETE Algorithm based Rule Engine would work for your case. You can try drools.

I think you're trying to develop an expert system. You can check the term and then check the appropriate programming languages as prolog etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!