An example for your feedback

37 views
Skip to first unread message

TzahiJ

unread,
Apr 18, 2019, 5:13:13 PM4/18/19
to PSL Users

Hi all,

I would like to present a toy problem with my solution, and get your opinion on it.

The Problem:

There are two people p1 and p2. For each one of them, we have four possible addresses. . p1 may live in a1,a2,a3 and a4. P2 may live in a1,a5,a6,a7. So both may live in a1, but only one of them may live in a2-a7.

If that’s all we know, then the chance of a person to live in any addresses  is the same. But if we get information that there is a 50% chance that p1 and p2 are married, than their chances of living in a1 are much higher.

I defined the following predicates:

1.       PossibleAddress/2 - closed

2.       PossiblyMarried/2 - closed

3.       LivesAt/2 - open

4.       Married/2 - open

And the rules are:

Prior rules.

5: !LivesAt(P,A)

5: !Married(P1,P2)

Next rule(constraint) states that the sum of the probabilities that a person live in an address is 1.0:

LivesAt(P,+A) = 1.{A:PossibleAddress(P,A)}

Now for the rule about married people living in the same address, and people that live together may be married:

30: PossiblyMarried(P1,P2) & PossibleAddress(P1,A) & PossibleAddress(P2,A) -> LivesAt (P1,A)| LivesAt(P2,A) | Married(P1,P2).

The last rule behaved a bit strange. At the end I duplicated the body to two rules and separated the LivesAt part of the head from the married predicate.

Is that a correct way to answer the initial question? Another approach? I would love to get your feedback.

Thanks, Tzahi

 

 

 

 

 

5: Person(P) & Address(A) -> !LivesAt(P,A)  # prior rule

5:Person(P1) & Person(P2) -> !Married(P1,P2) # prior rule

 LivesAt(P,+A) = 1{A:PossibleAddress.(P,A)} # a person lives in one of his possible addresses

PossiblyMarried(P1,P2) & PossibleAddress(P1,A) & PossibleAddress(P2,A) -> LivesAt (P1,A)| LivesAt(P2,A)| Married(P1,P2)

Eriq Augustine

unread,
Apr 18, 2019, 5:44:56 PM4/18/19
to TzahiJ, PSL Users
Hey Tzahi,

What about going with something like:
30: PossiblyMarried(P1,P2) & PossibleAddress(P1,A) & PossibleAddress(P2,A) & LivesAt(P1,A) & LivesAt(P2,A) -> Married(P1,P2)

So: "If two people live at the same location, then there is evidence they are married".
(Of course keeping in mind that open predicates can appear on either side of the rule.)

-eriq

--
You received this message because you are subscribed to the Google Groups "PSL Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psl-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TzahiJ

unread,
Apr 18, 2019, 6:32:11 PM4/18/19
to PSL Users
The original rule was " PossibleAddress(P1,A) & PossibleAddress(P2,A) & PossiblyMarried(P1,P2) -> Married(P1,P2) "
it resulted in "Married(p1,p2) = 0.5"
The rule with your suggestion "PossibleAddress(P1,A) & PossibleAddress(P2,A) & PossiblyMarried(P1,P2) & LivesAt(P1,A) & LivesAt(P2,A)-> Married(P1,P2) "
Resulted in  "Married(p1,p2) = 0"
My understanding is that each predicate that I add with AND to the body lowers the resulting probability if it is not 100% true.
Not sure I understand it.  Additional hints should make the result more probable, not less.
Seems like if follows the disjunctive formula Max(0,A + B - 1).

Regards, and thanks, Tzahi 



Bruno Godefroy

unread,
Apr 19, 2019, 4:45:46 AM4/19/19
to PSL Users
Hi Tzahi,

This an interesting problem, thanks for sharing.

Here is how I would write the rules:
LivesAt(P,+A) = 1.{A:PossibleAddress(P,A)} 
30: PossiblyMarried(P1,P2) & PossibleAddress(P1,A) & PossibleAddress(P2,A) & LivesAt(P1,A) & LivesAt(P2,A) -> Married(P1,P2) ^2 
30: PossiblyMarried(P1,P2) & PossibleAddress(P1,A) & PossibleAddress(P2,A) & LivesAt(P1,A) & Married(P1,P2) -> LivesAt(P2,A) ^2 
30: PossiblyMarried(P1,P2) & PossibleAddress(P1,A) & ~PossibleAddress(P2,A) & Married(P1,P2) -> ~LivesAt(P1,A) ^2 
30: PossiblyMarried(P1,P2) & PossibleAddress(P2,A) & ~PossibleAddress(P1,A) & Married(P1,P2) -> ~LivesAt(P2,A) ^2

This gives the output:
MARRIED('p1', 'p2') = 0.707
LIVESAT('p1', 'a1') = 0.356
LIVESAT('p2', 'a1') = 0.356

Also, to initialize the open predicates with a value, you should use the following options:
-D admmreasoner.initialconsensusvalue=ATOM 
-D admmreasoner.initiallocalvalue=ATOM

Find attached the full PSL project.

Best,
Bruno
problem_PSL.zip
Reply all
Reply to author
Forward
0 new messages