[rules-users] Using Drools Fusion to compute overlaps of many intervals

Raphael Jolivet raphael.jolivet at gmail.com
Wed Aug 14 15:37:57 EDT 2013


Hi Drools guys.

I just asked the following question on
StackOverlow<http://stackoverflow.com/questions/18219841/using-drools-fusion-to-compute-overlaps-of-many-intervals>
.
Could you please help :

I am already using Drools to do some *preprocessing of an allocation problem
* (resources vs operations). The operations are already time *intervals* but
I did not need to leverage the Drools Fusion features yet.

There is a new requirement for having some *attributes of my resources
changing over time*.

I am willing to model this (the change of values over time) as *"events" in
Drools* and take advantage of Drools Fusion, in *Cloud* mode.

Hence I will have to match those "dynamic" attributes events against my
operations (again declared as events in Drools fusion). This will require
Drools to *compute a great amount of intervals overlaps*.

I have several questions :

   - I have found the *overlap* operator to be kind of counter-intuitive,
   and to not actually process*overlap* as we usually describe it. I would
   expect [a;b] and [c;d] to overlap if *(b > c) and (a < c)*. Is there a
   time operator for that ? Or should I use a composition of several time
   operators ?
   - Does Drools Fusion uses any kind of internal optimization for this
   kind of problem ? Naively matching N intervals against M intervals would
   require *0(N x M)* operations. I have found a way to go down to *(M x
   log(M) + N x log(N))*, by sorting the intervals beforehand : Should I
   prepare the pair of overlaps for Drools in advance ?
   - Related to the previous question : Is there any benefit in this case
   (in term of performances), of using *Drools Fusion* instead of *regular
   Drools* together with conditions over timestamps and duration ?

Thanks for your advice
Brgds,

-- Raphael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130814/9f74f76c/attachment.html 


More information about the rules-users mailing list