Thursday, September 27, 2007

Drools - Uncertainty Systems

Davide Sottara has been working on the foundations for a Drools partial data reasoning, for his Phd, with Uncertainty Systems to express truth degrees. He's made a small screenshot for us along with the proposed syntax. The idea is that different uncertainty systems can be configured to handle different evaluators for a given object type and field name - making it seamless to the rule language, beyond the notation shown.


  • Traditional Pattern
    • Shower( temperature == “hot” )
  • Pattern with uncertainty evaluator
    • Shower( temperature == ~“hot” )
  • Pattern with uncertainty evaluator and parameters
    • Shower( temperature == ~(10, $x, 15, $y) “hot” )

Wednesday, September 26, 2007

JBoss Drools - 20K downloads this month and still going :)

Last month the -bin.zip had 16.5K downloads, this month its got to 20K downloads and we still have 4 more days to go - I'm looking forward to when we reach 30K downloads :)

Monday, September 24, 2007

Drools solver in a nutshell

Drools-solver combines a search algorithm with the power of the drools rule engine to solve planning problems, such as:

  • Employee shift rostering

  • Freight routing

  • Supply sorting

  • Lesson scheduling

  • Exam scheduling

Drools-solver supports several search algorithms, such as simple local search, tabu search and simulated annealing. You can easily switch the search algorithm, by simply changing the configuration. There's even a benchmark utility which allows you to play out the different search algorithms against each other on your planning problem.

Drools-solver uses the drools rule engine to calculate the score, based on score rules. This allows you to easily add hard and soft constraints in your score function, simply by adding a score rule.

It's available now in the drools trunk and the manual explains how to run the examples yourself in no time.

Sunday, September 23, 2007

Drools Solver

Geoffrey De Smet has been busy working on the Drools Solver module, which will hopefully be part of the next major Drools release. Drools solver aims to efficiently solve search based problems finding a valid solution from large search areas. It currently provides implementations for Tabu, simulated annealing and Local search. I personally hope to expand the system for Genetic Algorithms in the future, I'll have a good look at jgap too see if we can provide true value over existing systems.

Geoffrey has started to flesh out the manual and is looking for feedback, it focuses on explaining the engine via solving the N-Queens problems.

Drools Solver Manual

Drools Solver provides a framework for searching and uses Drools to provide the scoring, moves themselves are still done in Java code. I know that Geoffrey long term is hoping to have the move instructions also as part of the DRL.

Friday, September 14, 2007

Synasc, Business Rules Forum and RuleML

Members of the Drools team will be at three conferences during September and October. Being a globally dispersed team we'll also be using this time to do plenty of R&D, so if you want to get together for some really heavy technical stuff, then you know where to go :) Of course we'll also chat about our stuff, at any level, to just about anyone who will listen :)

Synasc 2007 ( September 26-29, 2007 ) http://synasc07.info.uvt.ro
9th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing
Timisoara, Romania

Kris and myself will be at Synasc 2007, where there will be a 2 hour intermediate Drools session with a focus on declarative programming.

Business Rules Forum and RuleML2007 http://www.businessrulesforum.com http://2007.ruleml.org (October 21-26, 2007)
Orlando, USA

Edson and myself will be attending both conferences, I'm also on panel with a preliminary title "Rule Interchange and Applications:Practice and Opportunities".

Sounds like what?? (Michael Neale)

We have for some time been using the MVEL expression language magic, from Mike Brock. This has served us well, but I found that it has some funky features like "soundex" built in. This allows you to match text based on the soundex algorithm (ie a word sounds like another word).

In 4.0.2, this is available as a proper operator in rules:

Cheese(name soundslike "steelton")

And in the GUI:

You can of course do this in predicates/eval (along with other cool things that MVEL has hidden in it). Handy !

Thursday, September 13, 2007

JBoss Drools - What a difference two years make

I'm just updating the Fibonacci example as we overhaul and start to document drools-examples. For a bit of nostolgia I thought I'd show how Fibonacci looked 2 years ago with Drools 2.0 and how it looks now with Drools 4.0 and the new MVEL dialect.

Drools 4.0
package org.drools.examples

import org.drools.examples.FibonacciExample.Fibonacci;

dialect "mvel"

rule Recurse
salience 10
when
f : Fibonacci ( value == -1 )
not ( Fibonacci ( sequence == 1 ) )
then
insert( new Fibonacci( f.sequence - 1 ) );
System.out.println( "recurse for " + f.sequence );
end

rule Bootstrap
when
f : Fibonacci( sequence == 1 || == 2, value == -1 ) // this is a multi-restriction || on a single field
then
modify ( f ){ value = 1 };
System.out.println( f.sequence + " == " + f.value );
end

rule Calculate
when
f1 : Fibonacci( s1 : sequence, value != -1 ) // here we bind sequence
f2 : Fibonacci( sequence == (s1 + 1 ), value != -1 ) // here we don't, just to demonstrate the different way bindings can be used
f3 : Fibonacci( s3 : sequence == (f2.sequence + 1 ), value == -1 )
then
modify ( f3 ) { value = f1.value + f2.value };
System.out.println( s3 + " == " + f3.value ); // see how you can access pattern and field bindings
end


Drools 2.0
<rule-set name="fibonacci"
xmlns="http://drools.org/rules"
xmlns:java="http://drools.org/semantics/java"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/rules rules.xsd
http://drools.org/semantics/java java.xsd">

<import>org.drools.examples.fibonacci.Fibonacci</import>

<rule name="Bootstrap 1" salience="20">
<parameter identifier="f">
<class>Fibonacci</class>
</parameter>

<java:condition>f.getSequence() == 1</java:condition>
<java:condition>f.getValue() == -1</java:condition>
<java:consequence>
f.setValue( 1 );
System.err.println( f.getSequence() + " == " + f.getValue() );
drools.modifyObject( f );
</java:consequence>
</rule>

<rule name="Bootstrap 2">
<parameter identifier="f">
<class>Fibonacci</class>
</parameter>
<java:condition>f.getSequence() == 2</java:condition>
<java:condition>f.getValue() == -1</java:condition>
<java:consequence>
f.setValue( 1 );
System.err.println( f.getSequence() + " == " + f.getValue() );
drools.modifyObject( f );
</java:consequence>
</rule>

<rule name="Recurse" salience="10">
<parameter identifier="f">
<class>Fibonacci</class>
</parameter>
<java:condition>f.getValue() == -1</java:condition>
<java:consequence>
System.err.println( "recurse for " + f.getSequence() );
drools.assertObject( new Fibonacci( f.getSequence() - 1 ) );
</java:consequence>
</rule>

<rule name="Calculate">
<parameter identifier="f1">
<class>Fibonacci</class>
</parameter>
<parameter identifier="f2">
<class>Fibonacci</class>
</parameter>
<parameter identifier="f3">
<class>Fibonacci</class>
</parameter>
<java:condition>f2.getSequence() == (f1.getSequence() + 1)</java:condition>
<java:condition>f3.getSequence() == (f2.getSequence() + 1)</java:condition>
<java:condition>f1.getValue() != -1</java:condition>
<java:condition>f2.getValue() != -1</java:condition>
<java:condition>f3.getValue() == -1</java:condition>
<java:consequence>
f3.setValue( f1.getValue() + f2.getValue() );
System.err.println( f3.getSequence() + " == " + f3.getValue() );
drools.modifyObject( f3 );
drools.retractObject( f1 );
</java:consequence>
</rule>

</rule-set>

Drools Quickies

Sammy Larbi has done a nice intro to Drools with a simple example Rules-based Programming with JBoss Rules/Drools.

Drools has won an InfoWorld Bossie :) http://www.infoworld.com/slideshow/2007/09/116-best_of_open_so-5.html

Final download stats for Drools in August where:
16293 drools-4.0.0-bin.zip
8364 drools-4.0.0-brms-standalone.zip
7207 drools-4.0.0-src.zip
6978 drools-4.0.0-eclipse.zip
5921 drools-4.0.0-brms.zip
5191 drools-4.0.0-examples.zip

Friday, September 07, 2007

MVEL 1.2 is out

MVEL 1.2 is out and announced at TSS, see link here. Congratulations to Chris Brock on his release, and a big thank you from the Drools team for all the hard work you have put in, to help deliver a great business scripting language for Drools. Bring on MVEL 2.0 :)

Wednesday, September 05, 2007

OSWorkflow Books and Drools Integration Chapter

Diego Adrian Naya Lazo has just published an OSWorkflowBook "OSWorkflow: A guide for Java developers and architects to integrating open-source Business Process Management".

I've no idea if the book is any good or not but it has a whole chapter on Drools integration:
Chapter 5 introduces and integrates Rules engine and Drools open source rule engine.

So if anyone reads this book, please do post us a review we can place here. And Diego, any chance you could email me chapter 5, as a free sample :)

What I found more interesting is that a non JBoss workflow engine put in a chapter about Drools integration, but the JBoss jBPM book "Business Process Management with JBoss jBPM" didn't. I did notice that the book refers to us as just Drools, I hope somewhere prominently in the chapter that JBoss are given credit.