Re: JESS: Track and redo actions

2008-12-11 Thread Wolfgang Laun
Sorry for the delay.

I'd say that if the full evaluation of the simulation of some reaction
requires changes
in the representation of the real world in several stages (*) then
Ernest's proposal of
using two engines is best.

(*) Several stages is crucial. If it is just an assessment of the determined
reaction, you don't make any changes to the facts representing the environment,
but I think that's not what you need to do:
   Implement determined action on the simulated world facts
   Rules fire, causing secondary changes  on the simulated world facts
  (and so on, until it dies down)

If you do use two engines, you'll need to copy all the facts from the
hot engine to
the simulation engine, at least when you know that they have drifted apart. This
may cause a considerable overhead depending on the number of facts and rules.

Wolfgang

On Fri, Dec 5, 2008 at 9:14 AM, Nick Tinnemeier [EMAIL PROTECTED] wrote:
 Wolfgang, thank you for your reply. You are right I should provide some
 explanation of the problem I am trying to solve here. Could be that you have
 an even better solution. :-)

 I have two modules. One module represents the facts about the real world
 that is possibly modeled by Java objects, which means that some shadow facts
 might be involved. The other module's purpose is to reason about what the
 effect of firing some rules would be in the environment, without - and this
 is of crucial importance - modifying this real world. This other module does
 not contain shadow facts. It is intended to be a dry run. Then, based on
 some evaluation of the resulting fact base, I would like to effectuate the
 result in the real world or not. A rollback mechanism is not an option
 because modifying the Java code might have side effects which cannot be
 undone, e.g. sending an e-mail.

 One solution I had in mind is to make an exact copy of the modules, i.e.
 copying all the deftemplates (mimicking defclasses) and rules. Effectuating
 the result of the dry run in the real world then becomes a matter of simply
 switching focus to the other module and running it. It seemed to me that
 doing exactly the same thing twice would be rather silly and it would be
 more appropriate to use the track and redo actions approach I mentioned in
 my earlier post. Now I realize that doing this might be a bit tricky, as
 retracting and modifying facts depends on a fact id (are these the same in
 both modules?).

 Hope this information gives some more insight in what I am trying to do
 here.

 Cheers,
 Nick.


 Wolfgang Laun wrote:

 First, I would not use defadvice. If you call assert in the second
 module, you won't want to add the argument to the linked list. I *think*
 that event handling would be more appropriate, even though this might mean
 that you'll have to write some Java code.

 You write that you want to repeat all assert, modify and retract calls in
 the second module. It seems that you'll want to have the facts in that
 second module to be a copy of the ones in the first module. If that is so,
 what is the purpose of this exercise? Saving facts so that they can be
 safely restored later on can be achieved easier by, e.g., calling
 save-facts.

 I hate to give advice without understanding what the other guy is trying
 to do; discussing things on a mere technical basis is (mostly) a waste of
 time...

 Cheers
 Wolfgang

 On Thu, Dec 4, 2008 at 12:57 PM, [EMAIL PROTECTED] mailto:[EMAIL 
 PROTECTED]
 wrote:

Hi,

I have two modules that are similar. The rules are fired on one
module and
there facts are asserted, modified and retracted. Based on some value
these actions need to performed on the second module. I thought it
might
be a good idea to approach it in this way:

(defglobal ?*acts* = (new LinkedList))

(defadvice before assert
   (?*acts* add $?argv)
)

(deffunction makeithappen ( )
   (foreach ?a ?*acts*
; call the action
   )
)

In words, I store all the actions in the acts list whenever assert is
called. Then, the function makeithappen calls all the functions
again, but
then on the second module. How can I do this? Or is there another way?

Regards,
Nick.





To unsubscribe, send the words 'unsubscribe jess-users
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED].






 
 To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
 in the BODY of a message to [EMAIL PROTECTED], NOT to the list
 (use your own address!) List problems? Notify [EMAIL PROTECTED]
 

Re: JESS: how to write If else rule

2008-12-11 Thread Joao Antunes Mourao

(defrule name-of-the-rule
   (put here your conditions for the rule, if any)
=
(if (condition) then
   (put your things here)
)
(if (condition) then
   (put your things here)
else
   (put your things here)
))

Simple. Good luck.

Joao
---
unclassified email

On 10-12-2008 05:47, hansari wrote:

I need rule for

if (condtion1)
 then (acton1)
if else (conditon2)
then   (action2)
if else (condition3)
then (action3)
else (acton4)

how can perform this by using defrule 
please help me.


thank you. 
  




Disclaimer:

If you are not the intended recipient of this email, please notify the sender and delete it. 
Any unauthorized copying, disclosure or distribution of this email or its attachment(s) is forbidden. 
Thales Nederland BV will not accept liability for any damage caused by this email or its attachment(s). 
Thales Nederland BV is seated in Hengelo and is registered at the Chamber of Commerce under number 06061578.



begin:vcard
fn;quoted-printable:Jo=C3=A3o Mour=C3=A3o
n;quoted-printable;quoted-printable:Mour=C3=A3o;Jo=C3=A3o
org:Thales;Above Water Systems
adr:;;;Hengelo;;;Netherlands
email;internet:[EMAIL PROTECTED]
title:THALES NETHERLANDS B.V.
tel;work:2640
note:-unclassified mail-
version:2.1
end:vcard



Re: JESS: how to write If else rule

2008-12-11 Thread Dusan Sormaz

Joao,

I beg here to differ from this approach.

This approach shows how to write if-then-else  in Lisp, which is not 
different from writing them in any language with if-then-else 
conditional statements (and all of them support IF logic).


Writing your conditions in a rule language like Jess assumes that you 
utilize benefits of rule-based approach, which includes data-driven 
order of execution.


Dusan Sormaz

Joao Antunes Mourao wrote:

(defrule name-of-the-rule
   (put here your conditions for the rule, if any)
=
(if (condition) then
   (put your things here)
)
(if (condition) then
   (put your things here)
else
   (put your things here)
))

Simple. Good luck.

Joao
---
unclassified email

On 10-12-2008 05:47, hansari wrote:

I need rule for

if (condtion1)
 then (acton1)
if else (conditon2)
then   (action2)
if else (condition3)
then (action3)
else (acton4)

how can perform this by using defrule please help me.

thank you.   



 


Disclaimer:

If you are not the intended recipient of this email, please notify the 
sender and delete it. Any unauthorized copying, disclosure or 
distribution of this email or its attachment(s) is forbidden. Thales 
Nederland BV will not accept liability for any damage caused by this 
email or its attachment(s). Thales Nederland BV is seated in Hengelo 
and is registered at the Chamber of Commerce under number 06061578.
 





--
***
* Dusan Sormaz, PhD, Associate Professor
* Ohio University
* Department of Industrial and Systems Engineering
* 284 Stocker Center, Athens, OH 45701-2979
* phone: (740) 593-1545 
* fax:nbsp;nbsp; (740) 593-0778
* e-mail: [EMAIL PROTECTED] 
* url: http://www.ent.ohiou.edu/~sormaz

***




To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]