<div dir="ltr">Thanks .<br>This completely answers my questions.<br><br>Raphael</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/8/15 Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">See inline.<br>
<div class="im"><br>
On 14/08/2013, Raphael Jolivet <<a href="mailto:raphael.jolivet@gmail.com">raphael.jolivet@gmail.com</a>> wrote:<br>
> Hi Drools guys.<br>
><br>
> I just asked the following question on<br>
</div>> StackOverlow<<a href="http://stackoverflow.com/questions/18219841/using-drools-fusion-to-compute-overlaps-of-many-intervals" target="_blank">http://stackoverflow.com/questions/18219841/using-drools-fusion-to-compute-overlaps-of-many-intervals</a>><br>
<div class="im">> .<br>
> Could you please help :<br>
><br>
</div>> I am already using Drools to do some *preprocessing of an allocation<br>
> problem<br>
> * (resources vs operations). The operations are already time *intervals*<br>
<div class="im">> but<br>
> I did not need to leverage the Drools Fusion features yet.<br>
><br>
</div>> There is a new requirement for having some *attributes of my resources<br>
> changing over time*.<br>
><br>
> I am willing to model this (the change of values over time) as *"events" in<br>
> Drools* and take advantage of Drools Fusion, in *Cloud* mode.<br>
<div class="im">><br>
> Hence I will have to match those "dynamic" attributes events against my<br>
> operations (again declared as events in Drools fusion). This will require<br>
</div>> Drools to *compute a great amount of intervals overlaps*.<br>
><br>
> I have several questions :<br>
><br>
> - I have found the *overlap* operator to be kind of counter-intuitive,<br>
> and to not actually process*overlap* as we usually describe it.<br>
<br>
The definition of temporal operators in Drools follows<br>
well-established research. The intent is to be able to pinpoint very<br>
specific relations, with more general or symmetric relations requiring<br>
disjunctions.<br>
<br>
> I would<br>
> expect [a;b] and [c;d] to overlap if *(b > c) and (a < c)*. Is there a<br>
<div class="im">> time operator for that ?<br>
<br>
</div>There are only those described in the Fusion manual.<br>
<div class="im"><br>
> Or should I use a composition of several time<br>
> operators ?<br>
<br>
</div>Basically: yes, but see below.<br>
<br>
> - Does Drools Fusion uses any kind of internal optimization for this<br>
> kind of problem ?<br>
<br>
Not anything beyond the optimization provided by Rete (or whatever<br>
algorithm the Engine uses). You can look at the implementations of the<br>
operators: it's a pretty straightforward set of comparison, although<br>
the operator parameters add a level of complexity.<br>
<br>
You probably should implement your specific concept of "overlap" as a<br>
custom operator.<br>
<div class="im"><br>
> Naively matching N intervals against M intervals would<br>
</div>> require *0(N x M)* operations. I have found a way to go down to *(M x<br>
> log(M) + N x log(N))*, by sorting the intervals beforehand : Should I<br>
<div class="im">> prepare the pair of overlaps for Drools in advance ?<br>
<br>
</div>You may have to design an approach that accumulates events as they<br>
occur, determining whether a new event is one that joins a set of<br>
overlapping events or not.<br>
<br>
> - Related to the previous question : Is there any benefit in this case<br>
> (in term of performances), of using *Drools Fusion* instead of *regular<br>
> Drools* together with conditions over timestamps and duration ?<br>
<br>
Drools Fusion *is* what you call "regular Drools". It is just a<br>
marketing curlicue, to put a tag on a relatively small set of<br>
features: timestamp/duration, temporal ops, windows, cloud/stream, and<br>
event expiry. But there's only one Engine. Especially temporal<br>
operators is just syntactic sugar.<br>
<br>
-W<br>
<div class="im"><br>
><br>
> Thanks for your advice<br>
> Brgds,<br>
><br>
> -- Raphael<br>
><br>
</div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br></div>