




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Chris BrooksDepartment of Computer ScienceUniversity of San Francisco
Department of Computer Science — University of San Francisco – p.1/
??
even^ use a minimax-style ap-proach to determinethe optimal actionsto take.
Initial $ {door 1, 1.0}^ $^
{door 2, 0.5}^ {door 3, 0.2}^ {door 2, 0.5}^ $20$
$ {door 3, 0.8} {reveal 2, 0.5} {reveal 2, 0.5} door door2 hasprize (^2) empty {door 1, 1.0}^ $10^ {door 2, 1.0}^ $
{door 3, 0.8}{door 3, 0.2}^ $10 $
$10 {door 3, 0.8}{door 3, 0.2} {door 2, 1.0} $20 {door 1, 1.0} $25 $10 Department of Computer Science — University of San Fra
s, an agent may take actions a, a, ..., a^12
.n Each action
acan lead to statesi^
s, s, ..., si^1 i^2
, withim
probability
p, p, ..., pi^1 i^2
im ∑ EU^ (a) =^ i
psij^ ij
We call the set of probabilities and associated states thestate transition model. The agent should choose the action
′^ athat maximizes
Department of Computer Science — University of San Francisco – p.3/
??
s^ given action
a
might depend on previous actions that were taken. Reasoning about long chains of probabilities can becomplex and expensive. The Markov assumption says that state transitionprobabilities depend only on a finite number of parents. Simplest: a first-order Markov process. State transitionprobabilities depend only on the previous state. This is what we’ll focus on.
Department of Computer Science — University of San Francisco – p.4/
??
stationary distribution This says that the probability of reaching a state
′^ sgiven
action^ a^ from state
s^ with history
H^ does not change.
Different histories may produce different probabilities Given identical histories, the state transitions will be thesame. We’ll also assume that the utility of a state does notchange throughout the course of the problem.^ In other words, our model of the world does notchange while we are solving the problem.
Department of Computer Science — University of San Fra
s, s, ..., s^12
.n
Let’s assign each state a utility or
reward^ R(s).i
Agent wants to maximize the sum of rewards. We call this formulation a Markov decision process.^ Formally:^ An initial state
s^0 A discrete set of states and actions A Transition model:
′ T (s, a, s )^ that indicates the
probability of reaching state
′^ sfrom^ s when taking
action^ a. A reward function:
R(s)
Department of Computer Science — University of San Francisco – p.6/
??
3 4 START
0.8 0.10.
(a)^
(b) + 1^ – Agent moves in the “intended” direction with probability0.8, and at a right angle with probability 0.2 What should an agent do at each state to maximizereward?
Department of Computer Science — University of San Francisco – p.7/
??
policy “If you’re below the goal, move up.” “If you’re in the left-most column, move right.” We denote a policy with
π, and^ π
(s)^ indicates the policy
for state^
s.
Department of Computer Science — University of San Fra
Department of Computer Science — University of San Francisco – p.9/
??
optimal
policy. Once an optimal policy is found, the agent can just lookup the best action for any state.
Department of Computer Science — University of San Francisco – p.10/
??
(^14) R s ( ) < 1.62840.4278 <^ < 0.0850 R s ( )^ +1^ –^1 > 0 R s ( ) (a)^
+1^ +1 –^1 –^1 +1^ –^1 < 0 R s ( )0.0221 <(b)
Left figure: R(s) = -0.04. Note: there are typos in this figure; all non-zero rewards should benegative.^ As the costs for nonterminal states change, so does theoptimal policy.^ Very high cost: Agent tries to exit immediately^ Middle ground: Agent tries to avoid bad exit^ Positive reward: Agent doesn’t try to exit.
Department of Computer Science — University of San Fran
Department of Computer Science — University of San Francisco – p.18/
??
) =^ R(s) +
∑ γmaxa ′^ T^ (s, a, s s
′′)U(s)i
This is guaranteed to converge to the solutions to theBellman equations.
Department of Computer Science — University of San Francisco – p.19/
??
+^ gamma^ *
max^ T(s,a,s’)
U(s’)
untilall^ utilities
change^ by
less^ then delta
where^ δ^ =^ error^ ∗
(1^ −^ γ)/γ
Department of Computer Science — University of San Fran
+1 -
1
2
3 4 6
5 7 -0.1^8
0.^
0.05 0. -0.02 0.^
-0.
0.^
Start by assigning random utilities to each state. Assume^
γ^ = 0.^8 Assume time cost is -0.04: (
R(s) =^ −
Assume error =0.01:
δ^ = 0.^0025
Department of Computer Science — University of San Francisco – p.21/
??
+1 -
1
2
3 4 6
5 7
8
9 -0.
0.^
0.62 0. 0.02 0.^
0.^
After one iteration, here are the estimated values.
Department of Computer Science — University of San Francisco – p.22/
??
+1 -
1
2
3 4 6
5 7
8
9
-0.^
0.65 0. -0.02 -0.^
0.^
After two iterations, here are the estimated values.
Department of Computer Science — University of San Fran
+1 -
1
2
3 4 6
5 7
8
9
0.^
0.69 0. -0.06 -0.^
-0.^
-0.
After three iterations, here are the estimated values.
Department of Computer Science — University of San Francisco – p.24/
??
+1 -
1
2
3 4 6
5 7
8
9
0.^
0.68 0. 0.07 -0.^
0.^
-0.
After four iterations, here are the estimated values.
Department of Computer Science — University of San Francisco – p.25/
??
+1 -
1
2
3 4 6
5 7
8
9
0.^
0.68 0. 0.13 0.^
0.^
-0.
After five iterations, here are the estimated values.
Department of Computer Science — University of San Fran
+1 -
1
2
3 4 6
5 7
8
9
0.^
0.68 0. 0.15 0.^
0.^
-0.
After six iterations, here are the estimated values. At this point, we are close to converging.
Department of Computer Science — University of San Francisco – p.27/
??
what to do
at each state.
Department of Computer Science — University of San Francisco – p.28/
??
Department of Computer Science — University of San Fran
+1 -
1
2
3 4 6
5 7
8
9
-0.^
-0.04 -0.^
-0.^
-0.^
-0. 0.63 0.
And use these new utility estimates to construct optimalpolicies^
Department of Computer Science — University of San Francisco – p.36/
??
+1 -
1
2
3 4 6
5 7
8
9
0.^
0.04 -0.^
-0.^
0.^
-0. 0.67 0.
Again, use the policies to re-estimate utilities
Department of Computer Science — University of San Francisco – p.37/
??
+1 -
1
2
3 4 6
5 7
8
9
0.^
0.04 -0.^
-0.^
0.^
-0. 0.67 0.
And then use the utilities to update your optimal policies.
Department of Computer Science — University of San Fran
+1 -
1 2
3 4 6
5 7
8 9
0.^
Department of Computer Science — University of San Francisco – p.39/
??
Department of Computer Science — University of San Francisco – p.40/
??
Department of Computer Science — University of San Fran
belief state
This is a probability distribution over states in theworld, indicating the belief that we are in a specificstate. We now have to explicitly consider sensing in our model. Agent takes an action Then senses where it thinks it is
Department of Computer Science — University of San Francisco – p.42/
??
o.
′′ b(s) =^ O
∑′(s, o) s
′T (s, a, s )b(s)
where^ O is an observation function that tells provides the agent with new information about the current state.^ If the environment is fully observable and sensors areerror-free, then
′ O(s, o) = ′^ sfor all ′ s. Department of Computer Science — University of San Francisco – p.43/
??
Department of Computer Science — University of San Fran
We can also learn a policy through interaction with theenvironment. This is known as
reinforcement learning
We’ll talk about this in a couple of weeks.
Department of Computer Science — University of San Francisco – p.45/
??
how to act optimally
for any state in a
problem.^ Must know state space, have a fixed goal. Value iteration and policy iteration can be applied tosolve this. In partiallly observable worlds, we can extend this modelto POMDPs.
Department of Computer Science — University of San Francisco – p.46/
??