Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ambiguous function warning for observation #99

Closed
zsunberg opened this issue Jun 21, 2016 · 1 comment
Closed

ambiguous function warning for observation #99

zsunberg opened this issue Jun 21, 2016 · 1 comment

Comments

@zsunberg
Copy link
Member

I'm just creating this issue to document what I did today to try to fix this. I'll close the issue, but I want to be able to find it later if it comes up.

If observation(a, sp) and observation(s,a,sp) are both in POMDPs.jl with their optional final arguments, there will be an ambiguous function warning. To get rid of this warning, we decided to just make the final argument non-optional. This shouldn't affect the problem-implementer other than that they might get a less easy-to-understand error message if they don't implement observation(s,a,sp).

The error can theoretically be fixed by defining a disambiguation method. The warning says...

To fix, define 
    observation(POMDPs.POMDP{_<:POMDPs.AbstractDistribution{#O<:Any}, _<:POMDPs.AbstractDistribution{#O<:Any}, #O<:Any}, _<:POMDPs.AbstractDistribution{#O<:Any}, _<:POMDPs.AbstractDistribution{#O<:Any}, _<:POMDPs.AbstractDistribution{#O<:Any})

Unfortunately, for reasons discussed in this issue: JuliaLang/julia#5384 , it is very difficult to figure out what function or combination of functions need to be implemented to solve the ambiguity. I tried many combinations using the following functions, but none were able to resolve the ambiguity between A and B without introducing new ambiguities:

abstract AbsD
abstract AbsP{S,A}

# f{SA}(p::AbsP{SA,SA}, s::SA, a::SA, sp::SA) = "disambiguation"
# f{D}(p::AbsP{D,D}, a::D, sp::D, d::D) = "disambiguation" # compatible with A, compatible with B, does not disambiguate
# f{S<:AbsD, A<:AbsD}(p::AbsP{S,A}, a::A, sp::S, d::A) = "disambiguation"

# f{S<:AbsD, A}(p::AbsP{S,A}, s::S, a::A, sp::S) = "disambiguation" # compatible with A
# f{S<:AbsD, A}(p::AbsP{S,A}, s::S, a::A, sp::AbsD) = "disambiguation" # compatible with A, not B


# f{S<:AbsD, A<:AbsD}(p::AbsP{S,A}, a::A, sp::S, d::S) = "disambiguation"
# f{S<:AbsD, A<:AbsD}(p::AbsP{S,A}, a::A, sp::S, d::AbsD) = "disambiguation" # C # disambiguates A and B, compatible with B


f{S,A}(p::AbsP{S,A}, s::S, a::A, sp::S) = "s,a,sp" # A
f{S,A}(p::AbsP{S,A}, a::A, sp::S, d::AbsD) = "a,sp,d" # B

Maybe one day we can figure this out, but for now it's too much of a time sink.

@zsunberg
Copy link
Member Author

closing for now, but this may come up again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant