[rules-users] Logical insert and cyclic rules dependences

zephyr ls262570 at students.mimuw.edu.pl
Tue Jul 3 05:21:52 EDT 2012


With

"a" is the only inserted fact

a->b->c->d->b

now b,c,d are logically added, b's ref cnt is 2

Fact b is NOT inserted again, (it's ref cnt is increased) and its more or
less what i wanted.

The problem is, when i remove fact a, b's ref cnt goes to 1, so it stays.

So b,c,d stay in fact memory because they support each other, even though
all stated facts that support them (fact a) were already removed.

Still no loop in rule firing, but i have junk in fact memory that can later
cause rules i don't want to fire fire.

Some less abstract example

see fire -> ring a bell
ring a bell -> bell rings
bell rings -> be alarmed
be alarmed -> there is alarm
there is alarm -> bell rings

When anyone sees fire i want all stuff to be in fact memory, but when all
decide they see no fire anymore and ring a bell disappears i would like this
alarm cycle that was logically inserted because of see fire to disappear.

(Maybe not the best example as here you should take some action to stop
ringing the bell, nad use ear not deduction to hear ringing, but im writing
a "thinking modelling system" and i haven't thought of better non abstract
example yet, though my system will be abstract and i do think there are less
stupid use cases when you would not like "unsupported logical circles" to
stay)


laune wrote
> 
> On 03/07/2012, zephyr <ls262570 at .edu> wrote:
>> In this case yes, but generally those dependences can be much more
>> complicated and this example is the simplest ilustration of the problem.
>>
>> It can also be
>>
>> a-> b ->c ->d ->b
> 
> 
> In this scenario, Fact b would not be inserted again, because thruth
> maintenance
> always uses equality, irrespective of the runtime configuration
> identity/equality.
> 
> Make sure to override equals and hashCode correctly, go by the book,
> 
> -W
> 
> 
>>
>> (that makes b,c,d equivalent, but is little less trivial to detect)
>>
>> or more complicated
>> a->b
>> b->c
>> c and d -> b
>> d nad a are facts, then a is removed
>> c and b are not eqivalent, but still support each other while there is
>> fact
>> d
>> etc.
>>
>> I just want logical facts that are not connected by any rule path with
>> inserted facts and only stay because of logical fact cycles to disapear.
>>
>> Im writing a system that takes user generated dependences as input and
>> its
>> main goal is to deal with different consequences, i thought drools might
>> be
>> a right tool to base this system on, this didnt work so i wonder is it a
>> common problem and is there an easy way to deal with it (or some way to
>> change drools to work like this).
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Logical-insert-and-cyclic-rules-dependences-tp4018381p4018397.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at .jboss
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
> _______________________________________________
> rules-users mailing list
> rules-users at .jboss
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


--
View this message in context: http://drools.46999.n3.nabble.com/Logical-insert-and-cyclic-rules-dependences-tp4018381p4018421.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list