Thursday, April 26, 2012

Drools&jBPM Drop in Centre at JBoss World

Now you have another reason to come to JBoss World, as if you didn't already have too many  on your list :)

On Friday the 29th of June we'll have an all day drop in centre for Drools & jBPM. We'll be having an all day team meeting and codeathon which will be open to the public. You can come along and hang out with us for the whole day and code, or just drop in for a bit and we'll help you with your questions.

Best of all Edson will be handing out free hugs all day.

Monday, April 23, 2012

Drools Pong hits home

This weekend I just finished the first cut for the class game Pong. The Wumpus World example I made was well received and the 20 minute YouTube video very populate, http://www.youtube.com/watch?v=4CvjKqUOEzM. However I've since been asked for something a little simpler and smaller for a getting started example, so I thought I'd do Pong.

The initial cut was done with a single commit, so it's easy to see all the code in one place:
https://github.com/droolsjbpm/drools/commit/2a8746a905efe1d9e0cc9f00eae06a50b76b214b

I'll follow up with a video soon, showing how it was made.


Thursday, April 19, 2012

Natural Language, Tracking and Supply Chain Management With Drools

I often spend time trawling through google scholar and citeseer, always lots of gems to be found there. Here are three recent papers I thought worth highlighting that utlised Drools in an applied way.

A New Algorithm for the Acquisition of Knowledge from Scientific Literature in Specific Fields Based on Natural Language Comprehension
http://www.scirp.org/fileOperation/downLoad.aspx?path=IJIS20110200002_46860321.pdf&type=journal

PeerTrack: A Platform for Tracking and Tracing Objects in Large-Scaoe Traceability Networks
http://www.edbt.org/Proceedings/2012-Berlin/papers/edbt/a54-wu.pdf

Introducing a Rule-Based Architecture For WorkFlow Systems in Retail Supply Chain Management
http://bada.hb.se/bitstream/2320/10632/1/2011MAGI24.pdf

Tuesday, April 10, 2012

jBPM Designer version 2.1 released

We are happy to announce that we have released version 2.1 of the jBPM Designer. This is a big release which solves many issues we had in 2.0 as well as adds lots of new features. We are especially happy that jBPM Designer will also be included in the up-coming JBoss BRMS 5.3 release.

Here is a summary of what’s new and noteworthy in Designer 2.1 and we have also included a video below. Try it out and let us know what you think!

New and noteworthy

  • Numerous bug fixes. The number of commits for bug-fixes alone was over 100 between 2.0 and 2.1.
  • Increased performance for user interactions with the UI as well as loading time (JavaScript is now served compressed)
  • New features: Support for Reusable Subprocesses (Call Activities), Multiple Instance Subprocesses, and Data Objects
  • New feature: Support for Stencil set Perspectives. Allows you to specify a specific superset or a subset of supported BPMN2 nodes grouped in a named stencil set
  • New feature: New data input editors. We added specific user-friendly editors for Process variables, Globals, Imports, Task Data Inputs/Outputs/Assignments, Called Elements, etc
  • New Feature: Process dictionary support. Allows you to define your own process dictionary and use it inside your business processes.
  • New Feature: In-Line editing of Process and User Task forms. This new feature allows you to create/modify your process and task forms in-line which is great as you do not have to leave your modelling environment to perform this feature.
  • New Feature: Code highlighting and Code completion in Expression editors, code highlighting for process and task form editors and source views.
  • New Feature: Smart node deletion – deleting a node will also delete its incoming and outgoing connections unless they specify an expression
  • Support for both Drools Guvnor 5.3 and 5.4

Here is also a video for the Designer 2.1 release.

You can download this version from soureforge just like the previous ones. Simply replace your existing designer war with the new one. Make sure to clear our your browser cache before starting to use the new version.

As always your feedback is more than welcome. Hit us up on IRC if you would like to contribute to the jBPM Designer. Have fun!

Drools 5.4.0.CR1 released

We're happy to announce the release of Drools (Expert, Fusion, Planner, Guvnor) 5.4.0.CR1.

Documentation, Release Notes and Downloads are detailed below:

Try it out and give us some feed-back (user list, issue tracker).

Monday, April 09, 2012

Plain old Java score calculation in Planner

In Drools Planner 5.4.0.CR1, you can now define your score calculation in plain old Java too. In fact, it supports 3 alternative score calculations:
  • Simple Java score calculator (new in 5.4)
  • Incremental Java score calculator (new in 5.4)
  • Drools DRL score calculator (the traditional way)
Unfortunately, each of these have advantages and disadvantages. Let's take a look at each of them.

Simple Java score calculator

This score calculator is very easy to implement. Just implement one method:
For example for NQueens:
It's that easy.
  • Advantages
    • No learning curve: it's plain old Java
    • Can delegate score calculation to an existing codebase
      • This is especially interesting when you're migrating from a legacy system and want to avoid a big bang conversion.
  • Disadvantages
    • Slow and less scalable, because it does not do incremental score calculation.

Incremental Java score calculator

This score calculator is very fast and scalable, but also very hard to implement, because you have to implement incremental score calculation yourself. You need to implement a bunch of methods on IncrementalScoreCalculator to make this happen. Here's a part of one NQueens implementation:
The implementation above isn't that good. Do you see how to optimize it? There's a much faster way to implement the NQueens score calculator, using Maps to avoid having to iterate through the insertedQueenList, but it makes the code even harder to understand.
  • Advantages
    • Very fast and scalable
      • Currently the fastest if implemented correctly (see benchmarks below)
  • Disadvantages
    • Incremental (AKA delta) calculation is hard to write and to maintain
    • You have to design and write all the performance optimizations yourself.

Drools DRL score calculation

This is the traditional and recommended way to implement score constraints, as Drools rules in DRL:
Notice the absence of incremental code, because Drools Expert does that for you automatically.
  • Advantages
    • Incremental score calculation without the boilerplate code for it
    • Flexibility for your score rules:
      • Define them in a decision table (XLS or Guvnor WebUI)
      • Store your rules in the Guvor repository
      • Translate them to natural language with DSL
    • Explain the score of a solution:
      • Just iterate over the ConstraintOccurrence instances to explain to the user why that score was the result.
    • In every major and minor release, Drools Expert becomes faster. There are several notable features on the Drools Expert roadmap that will make the Drools Score Calculator much faster:
      • More JITting
      • Undo then
      • Set based propagation
  • Disadvantages:
    • You need to learn and use DRL

Benchmark results

Because the score of a solution is always the same, no matter how it's calculated, the only notable measurement is the calculation speed relative to the problem size.

All benchmarks have be done with a warmup (to avoid JIT and DRL complication delays).

NQueens score calculation 

The results for 32, 64 and 256 queens:
 



Notice how the simple Java score calculator (red) does not scale at all. It starts out OK, but as the problem size gets bigger, it becomes very slow.

The drools calculator (in yellow - sorry that it's not very visible) starts slow on a trivial problem size, but scales up well. If we increase the number of queens even further, it will easily by-pass the basic incremental Java implementation. There's an well-known lesson to learn there: Don't let the performance results fool you into ignoring the scalability trend.

Notice the speed of the advanced incremental java score calculator (green), but don't forget that it's hard to write and to maintain the code behind it.

CloudBalance score calculation

This shows the results on 300, 600, 1200 and 2400 processes. The incremental Java score calculator also uses Maps extensively.

Notice that as the problem scales out, the Drools score calculator comes closer and closer to the hand-crafted incremental Java calculator.

Real problems

Both NQueens and CloudBalance are one of 4 toy examples, with only a few constraints. The 9 real examples have far more constraints (leaving more room for inter constraint optimization), so I suspect the benchmark results might be different there.

Wednesday, April 04, 2012

Prolog is Cool Again and Drools the DataBase

Rich Hickey has just done a interview at InfoQ on Datomic
http://www.infoq.com/interviews/hickey-datomic

In his talk he highlights their adoption of DataLog for their query format, and a transition away from an SQL approach to a rule based approach. DataLog is a Prolog derivitive, http://en.wikipedia.org/wiki/Datalog. It's great to see Prolog and rule based systems for query capabilities getting more attention again.

We added Prolog like capabilities to Drools earlier this year, that provides both queries but also reactive materialised views:
http://blog.athico.com/2011/04/backward-chaining-emerges-in-drools.html 

We are currently working on some proof of concepts around transactions and persistent data structures in Drools, along with OrientDB integration. So I hope we can see Drools the DataBase, via OrientBD integration before end of this summer.

GSOC Just 2 days left

If you want to suggest a project, or claim a project, you have just 2 days left to do so  - HURRY UP!!!
https://community.jboss.org/wiki/GSoC12Ideas