modelling uncertainty in 3apl johan kwisthout master thesis [email protected]
TRANSCRIPT
Motivation and Background
• 3APL uses logical formulae to represent and reason with agent beliefs which are either true or false, e.g.
whether(rain) temperature(low)
• However, in practice agents are confronted with uncertainty, e.g. ‘the chance or rain tomorrow is 70%’
• How can we model this uncertainty in 3APL
Layout
• Introduction to 3APL• Reasoning with uncertainty• Dempster-Shafer theory• Mapping Dempster-Shafer theory
to logical formulae• Reducing computational complexity• Querying and updating• Prototype implementation• Conclusion and further research
Introduction to 3APL
• Agent programming language using beliefs, desires (goals) and intentions
• Basic actions revise belief base• Practical reasoning rules reason on
the goals and revise them
{precondition} BasicAction {postcondition}{door_closed} OpenDoor {door_opened}
Goals guardNewGoalsTakeBus bus_strikeTakeTaxi
Concentrate on belief query and update
Reasoning with uncertainty
• Evidence: there is a bomb on location 3, with a certainty of 70%
• This could be denoted with a belief
formula and a probability: b(3) : 0.7
But what does this exactly mean?
4SAFE
3BOMB?
2BOMB
1SAFE
• A mine-sweeper type of game with four locations
Reasoning with uncertainty
• With four locations, we have 16 possible worlds:
s(1) s(2) s(3) s(4)…b(1) b(2) b(3) b(4)
• b(3) has a set of models, possible worlds in which b(3) is true
• Evidence of 0.7 that one of these is the actual world
Reasoning with uncertainty
• Various methods available:
• Bayesian networks• Dempster-Shafer theory• Fuzzy Logic systems• Ad-hoc implementations (e.g.
MYCIN certainty factors)
Bayesian Networks
• Network with nodes (variables) and causal relations between them
• Models causal structures: IF flu, THEN headache AND fever
Bayesian Networks
• Drawbacks:
- All conditional probabilities must be known beforehand
- Causal structure does not really fit in with 3APL belief structure
- Statically vs. dynamic
- No ignorance modeling possible
Dempster-Shafer theory• Frame of discernment Ω: set of
hypotheses relevant to this domain
• Mass function assigns a value 0 to every subset of Ω such that
• If no information is available, m(Ω) = 1 and m(X) = 0 for X Ω
• For example:
X
Xm 1)(
otherwise
if X
}H ,H ,H ,{H if X 4321
00
40
60
1
.
.
.
)(Xm
Dempster-Shafer theory
otherwise
if X
}H ,H ,H ,{H if X 4321
00
40
60
1
.
.
.
)(Xm
A simple support function has evidence for only one set of hypotheses, for example
otherwise.
if X .
}H ,{H if X .
}H ,{H if X .
)(43
21
00
40
30
30
2 Xm
This is not a simple support function because it has evidence for more than one set of hypotheses
Dempster-Shafer theory
0.60.30.3)},H,H,HBel({H 4321
otherwise0.0
}H ,{H if X 0.2
}H ,{H if X 0.2)(
65
54
}H ,{H X if0.3
}H ,H ,H ,{H X if0.3
21
4321
1Xm
XY
m(Y)Bel(X)
Belief function is defined to denote the probability of a set
Dempster-Shafer theory
• Separate pieces of evidence can be combined using Dempster’s Rule of Combination
otherwise0.0
if X 0.4
}H ,H ,H ,{H if X 0.6
(X)m
4321
1
otherwise0.0
if X 0.3
}H ,H ,H ,{H if X 0.7
(X)m
6543
2
otherwise0.00
if X 0.12
}H ,{H if X 0.42
}H ,H ,H ,{H if X 0.28
}H ,H ,H ,{H if X 0.18
(X)mm 43
6543
4321
21 021
21
21
21
)(
)()(
)()(
)(
mm
ZmYm
ZmYm
Xmm
ZY
XZY
D/S theory and agent beliefs
otherwise0.0
if X 0.3
b(3) if X 0.7
(X)mb(3)
²
With X ² b(3) denoting, that b(3) is the maximal subset of hypotheses in Ω that are models of b(3)
Consider the basic belief formula b(3):0.7. This basic belief formula could be modeled in Dempster-Shafer theory as follows:
D/S theory and agent beliefs
H1:S1S2S3S4
H5:S1B2S3S4
H9:B1S2S3S4
H13:B1B2S3S4
H2:S1S2S3B4
H6:S1B2S3B4
H10:B1S2S3B4
H14:B1B2S3B4
H3:S1S2B3S4
H7:S1B2B3S4
H11:B1S2B3S4
H15:B1B2B3S4
H4:S1S2B3B4
H8:S1B2B3B4
H12:B1S2B3S4
H16:B1B2B3B4
Y is the maximal subset of hypotheses from Ω that are models of b(3)
= {H3,H4,H7,H8,H11,H12,H15,H16}
D/S theory and agent beliefs
• Each logical formula in the belief base can be represented by a mass function
b(3):0.7
• Multiple beliefs can be represented by the combination of these mass functions
b(3):0.7 s(2):0.2 mb(3) ms(2)
otherwise0.0
if X 0.3
b(3) if X 0.7
(X)mb(3)
²
D/S theory and agent beliefs
• However, Dempster’s Rule of Combination leads to a combinatorial explosion
• Combining k mass functions leads to a mass function with 2k
separate clauses…
• …but this can be reduced with restrictions on the frame of discernment and on the mass functions
Simplifying combination rule
Dempsters Rule of Combination can be simplified to
If:
• The frame of discernment Ω is such that the combination of any mass function leads to a non-empy subset of Ω, and
• The mass functions that represent the belief formulae are simple support functions
XZ Y where),( )( Zm(Y)mXmm 2121
Mass calculation
Using this simplified rule, the mass value of any clause in the combination of the mass functions that represent the basic belief formulae in the belief base can be computed using the probabilities of that basic belief formulae, without having to calculate the complete combined mass function and therefore without having a combinatorial explosion.
Mass calculation
Belief base
b(1):p1
b(2):p2
s(3):p3
Mass function
mb(1) mb(2) ms(3)
m123(X ² b1b2) =
mb1(X ² b1) mb2(X ² b2) ms3(X = ) =
p1 p2 (1 – p3)
Because
(X ² b1b2) = (X ² b1) (X ² b2) (X = )
Updating the belief baseUpdate the belief base by just adding that belief formula, or recalculating the belief using Dempsters Rule of CombinationBelief base
b(1):p1
b(2):p2
s(3):p3
Mass function
mb(1) mb(2) ms(3)
Belief base
b(1):p1
b(2):p2
s(3):p3
s(4):p4
Mass function
mb(1) mb(2) ms(3) ms(4)
Belief base
b(1):p1
b(2):p2
s(3):p3
b(2):p4
Mass function
mb(1) mb(2) ms(3) mb(2)’
Belief base
b(1):p1
b(2):p2+p4-(p2p4)
s(3):p3
Mass function
mb(1) (mb(2) mb(2)’)
ms(3)
Querying the belief base• Query if a formula is deductible within
a certain range by calculating the Belief value
• A formula is deductible from a belief base BB with a certainty of Bel(mBB(X ² ))
where mBB is the combination of all mass functions that represent basic belief formulae in the belief base
Querying the belief baseBelief base
b(1):p1
b(2):p2
s(3):p3
Mass function
MBB = mb(1) mb(2) ms(3)
For example, we can calculate in how far b1 b2 is deductible from BB by calculating
Bel(mBB(X ² b1 b2))
Prototype implementation
• Algorithms implemented in Prolog, using interaction clauses for pre-condition, post-condition and guards
• 3APL interpreter uses Prolog Engine for logical reasoning
• With ‘real’ implementation, also graphical user interface needs to be adapted etc.
Prototype implementation?- add_fact(b1,0.4).Yes
?- add_fact(b2,0.6).Yes
?- add_fact(and(b2,b3),0.2).Yes
?- add_fact(or(b3,and(b3,b1)),0.3).Yes
?- show.
b1, 0.4b2, 0.6and(b2, b3), 0.2or(b3, and(b3, b1)), 0.3
Prototype implementation?- show.
b1, 0.4b2, 0.6and(b2, b3), 0.2or(b3, and(b3, b1)), 0.3
?- support(or(b1,b2)).0.808
?- pre(or(b1,b2),[0.6,0.9]).Yes
?- pre(or(b1,b2),[0.9,1.0]).No
Prototype implementation?- post([[and(b5,b2),0.2]]).
Yes
?- show.b1, 0.4b2, 0.6and(b2, b3), 0.2or(b3, and(b3, b1)), 0.3and(b5, b2), 0.2
?- support(or(b1,b2)).0.8464
Conclusion and further work
• Dempster-Shafer theory is a convenient method to model uncertainty in 3APL
• Computational complexity can be controlled
• Efficient algorithm for calculating Bel(X) to be designed
• Some theoretical questions to be addressed (e.g. closed world assumption in relation to combination rule)
Questions?