0

There need to be config files for specifying predicates that agents in a multi-agent model take into consideration when making decisions. Requirements: Users can specify boolean expressions and users can use a set of non-static methods defined in Java in their predicate definitions. e.g. like this (XML notation just used as an example):

<AgentConfigurations>
    <Agent Name="ExampleAgentConfig1">
        <Predicates>
            <Predicate Name="ThereIsAFullMoon">FullMoon("18/06/1987")</Predicate>
            <Predicate Name="DayNotTheFifth">5 != Today()</Predicate>
        </Predicates>
    </Agent>
</AgentConfigurations>

If I code this functionality myself, the method calling could be done using reflection but some parsing is required for the operators etc.

Is there a framework that could help with this?

Many thanks in advance, Thomas

Dr. Thomas C. King
  • 993
  • 2
  • 15
  • 28

2 Answers2

2

Consider using a "scripting" language like Groovy, JRuby, Scala, Rhino (even BeanShell), etc. They're great for "internal" DSLs and can remain very human-readable.

Alternatively, the stored expressions could be evaluated against a given context (like an object, or deeper structure) using any of several expression languages (ELs) like MVEL, OGNL, and so on.

Once they start getting complicated or have deep relationships between each other, you're better off with a rules engine like Drools or Jess.

You can do some very interesting things by pulling in rule definitions from a database, too, including live system updating (hopefully from a vetted test system).

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
2

Here are a few suggestions:

Community
  • 1
  • 1
Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674