JuliaPOMDP / POMDPs.jl

MDPs and POMDPs in Julia - An interface for defining, solving, and simulating fully and partially observable Markov decision processes on discrete and continuous spaces.
http://juliapomdp.github.io/POMDPs.jl/latest/
Other
671 stars 105 forks source link

QuickPOMDPs as Quick Start Example #244

Closed zsunberg closed 5 years ago

zsunberg commented 5 years ago

I changed the quick start example in the README to use QuickPOMDPs (see below).

Pros

Cons

I think the pros outweigh the cons for this - does anyone else have an opinion?

from README.md:

using POMDPs, QuickPOMDPs, POMDPSimulators, QMDP

S = [:left, :right]
A = [:left, :right, :listen]
O = [:left, :right]
γ = 0.95

function T(s, a, sp)
    if a == :listen
        return s == sp
    else # a door is opened
        return 0.5 #reset
    end
end

function Z(a, sp, o)
    if a == :listen
        if o == sp
            return 0.85
        else
            return 0.15
        end
    else
        return 0.5
    end
end

function R(s, a)
    if a == :listen  
        return -1.0
    elseif s == a # the tiger was found
        return -100.0
    else # the tiger was escaped
        return 10.0
    end
end

m = DiscreteExplicitPOMDP(S,A,O,T,Z,R,γ)

solver = QMDPSolver()
policy = solve(solver, m)

rsum = 0.0
for (s,b,a,o,r) in stepthrough(m, policy, "s,b,a,o,r", max_steps=10)
    println("s: $s, b: $([pdf(b,s) for s in S]), a: $a, o: $o")
    global rsum += r
end
println("Undiscounted reward was $rsum.")
codecov[bot] commented 5 years ago

Codecov Report

Merging #244 into master will decrease coverage by 0.3%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #244      +/-   ##
==========================================
- Coverage   71.88%   71.58%   -0.31%     
==========================================
  Files          10       10              
  Lines         466      468       +2     
==========================================
  Hits          335      335              
- Misses        131      133       +2
Impacted Files Coverage Δ
src/pomdp.jl 80% <0%> (-12.31%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update cc4cbef...6bccc33. Read the comment docs.

rejuvyesh commented 5 years ago

We can emphasize that this is only for simple domains!

zsunberg commented 5 years ago

Thanks @rejuvyesh , ok I think I'll merge this - if anyone really doesn't like it, we can always go back.