I had a go at doing this last night, but some unit tests now fail and two error; so something obviously isn&#39;t right.<div><br></div><div>I&#39;ll get back to it this evening and try to work out where I&#39;ve gone wrong (before asking for guidance to help me understand better).<br>
<br><div class="gmail_quote">On 15 September 2010 14:47, Mark Proctor <span dir="ltr">&lt;<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


  
    
  
  <div bgcolor="#ffffff" text="#000000"><div class="im">
    On 15/09/2010 14:35, Michael Anstis wrote:
    <blockquote type="cite">Is this in drools-core; or drools-compiler?
      <div><br>
      </div>
      <div>Whilst not undertaking to do the work; have a purpose to nose
        through the code makes understanding easier.<br>
      </div>
    </blockquote></div>
    It&#39;s all in DroolsCore.<br>
    <br>
    It&#39;s a 5 minute hack for me and then 15 minute unit writing test.
    But I thought I&#39;d write it up in a hope to bring someone else into
    the fold, we need more help writting the core engine someone else
    out there must want to work on current edge engine design :)<br>
    <br>
    if you look at the AbstractWorkingMemory insert method you&#39;ll see
    one argument is whether it&#39;s a logical insertion or not. You&#39;ll also
    see it check the global maintainTMS configuration and also retrieve
    the ObjectTypeConf. So between those things someone should be able
    to get it working.<br><font color="#888888">
    <br>
    Mark</font><div><div></div><div class="h5"><br>
    <blockquote type="cite">
      <div><br>
        <div class="gmail_quote">On 14 September 2010 16:47, Mark
          Proctor <span dir="ltr">&lt;<a href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
            <div bgcolor="#ffffff" text="#000000"> Here is another
              project proposal, this time simpler. I think this one has
              Wolfgang&#39;s name on it ;)<br>
              <br>
              <a href="http://blog.athico.com/2010/09/lazily-enabled-truth-maintenace.html" target="_blank">http://blog.athico.com/2010/09/lazily-enabled-truth-maintenace.html</a><br>
              <br>
              Three weeks ago I posted the project idea for <a href="http://blog.athico.com/2010/08/left-and-right-unlinking-community.html" target="_blank">&quot;Left and Right Unlinking&quot;</a>. So far
              there are no takers, so if you are interested let me know
              :)<br>
              <br>
              In the meantime I tried to think of a simpler enhancement
              that we would like to see done.<br>
              <br>
              At the moment Drools has a user setting
              &quot;MaintainTMSOption&quot; which can be true or false. It&#39;s a
              small optimisation that when turned off avoids using the
              equality hashmap that is maintained for all inserted
              objects.<br>
              <br>
              It would be a much better idea to remove this
              configuration setting, thus simplifying things for end
              users and have TMS lazily enabled on demand.<br>
              <br>
              For each object type there is an &quot;ObjectTypeConf&quot;
              configuration object that is retrieved every time a
              working memory action, such as insert, is executed. The
              enabledTMS boolean should be moved there, so there is one
              per object type, by default it is false.<br>
              <br>
              When a working memory action occurs, like insert, it
              retrieved the ObjectTypeConf and checks the maintainTms
              boolean there, instead of the current engine scoped
              configuration. When a logical insertion occurs and the
              ObjectTypeConf is retrieved if maintainTms is false it
              sets the value to true and then iterates the associated
              ObjectTypeNode memory lazily adding all the objects to the
              TMS equality map. From then on for that ObjectType all
              inserted objects are added to that equality map.<br>
              <br>
              With this you now have the advantage of TMS being laziy
              enabled, so the minor hashmap operation is no longer used
              and likewise a small memory saving from not populating the
              map. There is a further advantage that this is now fine
              grained and when enabled only impacts for that specific
              object type.<br>
              <br>
              A further enhancement could use a int counter, instead of
              a boolean. Each logical insertion for that object type
              increases the counter, each retraction decreases the
              counter; even if automatically retracted if the truth is
              broken for that logical assertion. When the counter
              reaches zero, TMS for that OTN can be disabled. We do not
              however remove the objects from the equality map, as this
              would cause &quot;churn&quot; if TMS is continuously enabled and
              disabled. Instead when TMS is disabled record the current
              fact counter id. Then if TMS is disabled on a retraction
              but there is a counter id, we can check that counter id to
              see if the fact is prior to TMS being disabled and thus
              would need to be retracted from the equality map.<br>
            </div>
            <br>
            _______________________________________________<br>
            rules-dev mailing list<br>
            <a href="mailto:rules-dev@lists.jboss.org" target="_blank">rules-dev@lists.jboss.org</a><br>
            <a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <pre><fieldset></fieldset>
_______________________________________________
rules-dev mailing list
<a href="mailto:rules-dev@lists.jboss.org" target="_blank">rules-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br></blockquote></div><br></div>