GEIST Research Group

We are GEIST. We dream big and work hard.

User Tools

Site Tools


pub:projects:samurai:cases:ploc
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


pub:projects:samurai:cases:ploc [2016/01/05 22:32] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +[[.:..:start|Powrót do samurai:start]]
  
 +====== PLOC ======
 +  * {{.:pl-oc.pdf|Orginal rules}}
 +  * {{.:ploc-rules.txt|}} - 49 rules
 +===== Model in CLIPS =====
 +  * Model 1: {{.:ploc-clips.clp|}}
 +  * Rules: 31
 +  * Uwagi:
 +    * It is necessary to use module mechanisms in order to avoid infinite recursion of rules that modify the facts that are also in their LHS.
 +    * In order to decrease number of rules, the predicates ''member$'' and ''create$'' were used for creation of multifield value (see here ''[[http://clipsrules.sourceforge.net/documentation/v630/bpg.htm#_Toc60827878|member$]]'')
 +    * It is necessary to set fact duplication to true in order to assert a number of the same insurance base charge modifiers ''[[http://clipsrules.sourceforge.net/documentation/v630/bpg.htm#_Toc60828120|(set-fact-duplication TRUE)]]''
 +    * It is not possible to express infinity (e.g. in case of declaring ranges of allowed values)
 +===== Model in Jess =====
 +  * Model 1: {{.:ploc-jess.clp|}}
 +  * Rules: 31
 +  * Uwagi:
 +    * Jess does not allow for using '(range)' construct within ''slot'' definition - the domain of slots can be set by using ''(allowed-values)''. However listing of all values from range e.g. [18, 120] is inefficient.
 +    * Jess does not allow for fact duplication :!: \\ //Fact-duplication concept eliminated -- fact duplication is never allowed. Fact list stored on a HashMap, not a Vector.// ((http://www.jessrules.com/doc/70/changes.html))
 +  * Model 2: {{.:ploc-jess-v2.clp|}}
 +  * Rules: 32
 +  * Uwagi:
 +    * The calculation rule uses ''accumulate'' CE and thus it is fired one instead of several times (for each ''base-modifier'' fact).
 +===== Model in Drools =====
 +  * Model 1: {{.:ploc.java|}} {{.:ploc-drools.drl|}}
 +  * Rules: 32
 +  * Uwagi:
 +    * Drools does not support neither default value nor constraints for fact fields.
 +    * The list of allowed values ''allowed-type'' can be defined using JAVA ''enum'' types.
 +    * Modules in Drools does not have to be defined explicitly - they are automatically defined while first rule assignment
 +    * :!: Drools does not support any construct with the semantics of ''(pop-focus)''. However, this construct can be approximately simulated in drools using ''lock-on-active'' property which prevents rule, with this property set to true, from firing until their ''agenda-group'' will not loose a focus. In comparison to ''(pop-focus)'' this property does not remove focus from the current module and thus other rules can also be fired after rule having this property set to true.
 +    * :!: The multifield values from clips and jess that are created using ''(create$)'' function, can be represented using Java collections (sometimes such rules must be expressed in //java// dialect): \\ CLIPS:<code lisp>(create$ 160 60 0 -10 -20 -30 -40 -40 -50 -50 -60)</code>Java:<code java>List<Integer> modifiers = Arrays.asList(160, 60, 0, -10, -20, -30, -40, -40, -50, -50, -60);</code>
 +    * The management of focus stack in Drools can be distributed on DRL and JAVA files. Drools allows for set the focus stack in the same way as ''CLIPS'' or ''Jess'': \\ CLIP/Jess <code lisp>(focus base-charge bonus-malus base-charge-modifiers)</code>and corresponding code in Drools:<code java>
 +ksession.getAgenda().getAgendaGroup("base-charge-modifiers").setFocus();
 +ksession.getAgenda().getAgendaGroup("base-charge").setFocus();
 +ksession.getAgenda().getAgendaGroup("bonus-malus").setFocus();
 +ksession.getAgenda().getAgendaGroup("initial").setFocus();
 +</code>Nevertheless, this can be done only within the Java file. In order to provide more more reliable translation from CLIPS/Jess to Drools the above setup of focus stack can be translated in the following way:
 +    - For each drools application, the java file push the first ''agenda-group'' (e.g. //initial//) on the focus stack.
 +    - Within this ''agenda-group'' only one rule is defined - LHS-less rule that asserts all the initial facts. Such rule corresponds to ''deffacts'' CLIPS/Jess construct.
 +    - In the RHS of this rule, the focus stack is defined e.g.<code java>
 +drools.setFocus("base-charge-modifiers");
 +drools.setFocus("base-charge");
 +drools.setFocus("bonus-malus");</code>the order of the ''agenda-grop'' names must be reversed in comparison to the order of the names within ''deffacts'' construct.
 +  * Model 2: {{.:ploc.java|}} {{.:ploc-drools-v2.drl|}}
 +  * Rules: 33
 +  * Uwagi:
 +    * The calculation rule uses ''accumulate'' CE and thus it is fired one instead of several times (for each ''base-modifier'' fact).
 +===== Model in XTT2 =====
 +  * Model 1: {{.:ploc-xtt.hml|}}
 +  * Rules: 57
 +  * Uwagi:
pub/projects/samurai/cases/ploc.txt · Last modified: 2016/01/05 22:32 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki