[rules-users] [Optaplanner] Help on drl

Wolfgang Laun wolfgang.laun at gmail.com
Fri Nov 29 03:00:38 EST 2013


On 28/11/2013, Tales Costa <tales at ibiseng.com> wrote:
> Hi,
>
> I am new to Drools and Optaplanner and have built a first model and
> succeeded running with java score calculation. Now am struggling trying to
> use rules for score.
>
> Have read "Drools Expert User Guide" and looked through Optaplanner
> examples but am still confused. Main difficult is discovering what can do
> and can´t do with java dialect within the "when" and "then" blocks. Are
> there tutorial and/or other references I could look into for more
> information on this ?

The rules are actually quite simple.

LHS: Any boolean expression is valid, with the shortcuts for accessing
members. If the parser misbehaves, try eval() - there it's pure Java.

RHS: Java code, as in any method, plus the "macros" defined in Expert.

That said, some things should not be done:
   * Never use side effects in LHS expressions that modifies anything
in working memory.
   * Don't write long "then" parts; calling static methods is preferred.

-W





>
> regards
>
> Tales
>



More information about the rules-users mailing list