This package constitutes the interface between the POMDPs.jl package and the file format .pomdp defined in POMDP.org.
Please use the following command to use this package
] add git@github.com:licioromao/POMDPFiles.jl.gitWildcardArrayPOMDP(s::Int, a::Int, o::Int, initial_state::InitialStateParam, discount::Float64, T::WildcardArray{Float64, 3}, O::WildcardArray{Float64, 3}, R::WildcardArray{Float64, 4})
WildcardArrayPOMDP(filename::String)Constructors for the WilcardArrayPOMDP. We allow the user to create this type either through a .POMDP file format or specifying manually the number of actions, initial distribution, and transitions using the type WildcardArrays. The API for the InitialStateParam is described below.
SWildcardArrayPOMDP(filename::String)
statenames(m::SWildcardArrayPOMDP)
actionnames(m::SWildcardArrayPOMDP)
obsnames(m::SWildcardArrayPOMDP) To deal with pomdp specifications where states, actions, and observations are specified with strings, i.e., ss = ["warm", "very-warm"], aa = ["north", "west", "east", "west"], one may use the SWildcardArrayPOMDP type. More details on the differences between these two types are presented below. Three methods, statenames, actionnames, and obsnames, are defined to retrieve the names associated with the corresponding field of an SWildcardArrayPOMDP type.
Warning: Functions
statenames,actionnames,obsnamesare not implemented for aWildcardArrayPOMDPtype.
mutable struct InitialStateParam
number::Int
type_of_distribution::String
support_of_distribution::Set{Int}
value_of_distribution::Vector{Float64}
end
InitialStateParam(number::Int) = InitialStateParam(number, " ", Set{Int}([]), Vector{Float64}([]))
InitialStateParam() = InitialStateParam(0)This is interface used to define the initial distribution of WildcardArrayPOMDP. It contains information about the number of states, support of the distribution, and a probability vector representation the initial distribution. The parameter type_of_distribution can either be equal to "uniform" or "general distribution".
In the example below we download the paint.95.POMDP file from POMDP.org and parse the content into a SWildcardArrayPOMDP variable type defined in this package. We then illustrate a few functionalities from POMDPs.jl.
using HTTP, POMDPs, POMDPFiles
mktempdir() do tmp_dir
url = "https://www.pomdp.org/examples/paint.95.POMDP"
tmp_file_name = joinpath(tmp_dir, "paint.95.POMDP")
HTTP.download(url, tmp_file_name)
pomdp = SWildcardArrayPOMDP(tmp_file_name)
states(pomdp)
endSome of the examples in POMDP.org, for instance, the mini-hall2, specifies a POMDP without associating names with states, actions, and observations. In these cases, one may use the WildcardArrayPOMDP type as described in the example below.
using HTTP, POMDPs, POMDPFiles
mktempdir() do tmp_dir
url = "https://www.pomdp.org/examples/mini-hall2.POMDP"
tmp_file_name = joinpath(tmp_dir, "mini-hall2.POMDP")
HTTP.download(url, tmp_file_name)
pomdp = WildcardArrayPOMDP(tmp_file_name)
initialstate(pomdp)
endUsing SWildcardArrayPOMDP in the previous example would allow us to refer to states, actions, and observations by means of a