<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">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</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 &lt;<a href="mailto:raphael.jolivet@gmail.com">raphael.jolivet@gmail.com</a>&gt; wrote:<br>
&gt; Hi Drools guys.<br>
&gt;<br>
&gt; I just asked the following question on<br>
</div>&gt; StackOverlow&lt;<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>&gt;<br>


<div class="im">&gt; .<br>
&gt; Could you please help :<br>
&gt;<br>
</div>&gt; I am already using Drools to do some *preprocessing of an allocation<br>
&gt; problem<br>
&gt; * (resources vs operations). The operations are already time *intervals*<br>
<div class="im">&gt; but<br>
&gt; I did not need to leverage the Drools Fusion features yet.<br>
&gt;<br>
</div>&gt; There is a new requirement for having some *attributes of my resources<br>
&gt; changing over time*.<br>
&gt;<br>
&gt; I am willing to model this (the change of values over time) as *&quot;events&quot; in<br>
&gt; Drools* and take advantage of Drools Fusion, in *Cloud* mode.<br>
<div class="im">&gt;<br>
&gt; Hence I will have to match those &quot;dynamic&quot; attributes events against my<br>
&gt; operations (again declared as events in Drools fusion). This will require<br>
</div>&gt; Drools to *compute a great amount of intervals overlaps*.<br>
&gt;<br>
&gt; I have several questions :<br>
&gt;<br>
&gt;    - I have found the *overlap* operator to be kind of counter-intuitive,<br>
&gt;    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>
&gt; I would<br>
&gt;    expect [a;b] and [c;d] to overlap if *(b &gt; c) and (a &lt; c)*. Is there a<br>
<div class="im">&gt;    time operator for that ?<br>
<br>
</div>There are only those described in the Fusion manual.<br>
<div class="im"><br>
&gt; Or should I use a composition of several time<br>
&gt;    operators ?<br>
<br>
</div>Basically: yes, but see below.<br>
<br>
&gt;    - Does Drools Fusion uses any kind of internal optimization for this<br>
&gt;    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&#39;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 &quot;overlap&quot; as a<br>
custom operator.<br>
<div class="im"><br>
&gt; Naively matching N intervals against M intervals would<br>
</div>&gt;    require *0(N x M)* operations. I have found a way to go down to *(M x<br>
&gt;    log(M) + N x log(N))*, by sorting the intervals beforehand : Should I<br>
<div class="im">&gt;    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>
&gt;    - Related to the previous question : Is there any benefit in this case<br>
&gt;    (in term of performances), of using *Drools Fusion* instead of *regular<br>
&gt;    Drools* together with conditions over timestamps and duration ?<br>
<br>
Drools Fusion *is* what you call &quot;regular Drools&quot;. 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&#39;s only one Engine. Especially temporal<br>
operators is just syntactic sugar.<br>
<br>
-W<br>
<div class="im"><br>
&gt;<br>
&gt; Thanks for your advice<br>
&gt; Brgds,<br>
&gt;<br>
&gt; -- Raphael<br>
&gt;<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>