-
Notifications
You must be signed in to change notification settings - Fork 100
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
gen
to replace generate_x
#240
Comments
The more I think about this, the more I think it is a good idea. Does anyone else have opinions? I am going to start on a test implementation to see how smooth the transition will be. |
Sounds good. |
I have implemented this in the
|
Regarding the disadvantages that you mentioned above:
|
This sounds like a good idea! We have to make sure that the fact that it should output a named tuple is well documented . |
Yes, particle filters will use |
This design directly violates the principle that generated functions should not observe global state (https://docs.julialang.org/en/v1/manual/metaprogramming/index.html#Generated-functions-1). I guess I need to rethink this. |
If anyone has any ideas how to implement this without |
Just to be clear on this: the observed global state is the |
No, it's the genvar_registry, which is accessed with genvar_data() here https://github.com/JuliaPOMDP/POMDPs.jl/blob/genvarmin/src/gen_impl.jl#L41 I am also definitely open to completely new designs (but we probably wouldn't be able to release by AA228) |
One of the things that makes this more difficult is throwing helpful errors. As of 0.7, when a generate function is missing the error says something like "no method for |
I feel like there must be a way to do this. Maybe this is a good question for discourse. Does the |
It can change when another package adds a genvar. e.g. ConstrainedPOMDPs.jl might add |
I don't see a PR for the |
Yeah, this afternoon I will submit a PR with this and the new DBN structure
stuff
…On Sun, Sep 1, 2019 at 10:54 AM Shushman Choudhury ***@***.***> wrote:
I don't see a PR for the genvarmin branch. Were you planning on doing
that @zsunberg <https://github.com/zsunberg> ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#240?email_source=notifications&email_token=ABALI22SV5VUCDIOC3BMYT3QHP6VJA5CNFSM4HPRHYB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5UHO4A#issuecomment-526940016>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABALI24NS7TK6ME4LN2N33TQHP6VJANCNFSM4HPRHYBQ>
.
|
* before branching off to gen2 * before gen3 * backup * before trying something new * before pivoting * more minimal implementation * before fixing #141 * quitting for the day * set up tests * before combination * before deleting a bunch * before genfallback experiment * got rid of genfallback * important tests pass * added some more error messages * checkpoint * moved genvars to new file * added Return * docstrings and errors * more docs about performance * before trying to merge master * before debugging worldage * before eval * added dbn struct stuff * to submit WIP PR * finished deprecated generate stuff * added dbn struct tests * almost complete - need to figure out generated function thing * all ready (-docs) fix #240 fix #256 * dbn struct interface * fixed tests * changed add_node * tested missing requirements * added GenDBNNode and node type docstrings * made add_node not @generated * added some docs * DBNDef -> DBNStructure * added dbn and generative docs * finished spitting out docs - still need to edit * finished docs * responded to all comments on the PR * bump version number, drop julia 0.7 testing * first pass at errors * completed testing of errors * DBN->DDN * finished calling everything DDNs * improved error * made errors a little better * fixed tests on 1.0, added 1.2 to Travis * added nodenames for DDNStructure type, ddn images * added a couple more sentences
* remove constants, old util functions * add gen and DBNStructure (#258) * before branching off to gen2 * before gen3 * backup * before trying something new * before pivoting * more minimal implementation * before fixing #141 * quitting for the day * set up tests * before combination * before deleting a bunch * before genfallback experiment * got rid of genfallback * important tests pass * added some more error messages * checkpoint * moved genvars to new file * added Return * docstrings and errors * more docs about performance * before trying to merge master * before debugging worldage * before eval * added dbn struct stuff * to submit WIP PR * finished deprecated generate stuff * added dbn struct tests * almost complete - need to figure out generated function thing * all ready (-docs) fix #240 fix #256 * dbn struct interface * fixed tests * changed add_node * tested missing requirements * added GenDBNNode and node type docstrings * made add_node not @generated * added some docs * DBNDef -> DBNStructure * added dbn and generative docs * finished spitting out docs - still need to edit * finished docs * responded to all comments on the PR * bump version number, drop julia 0.7 testing * first pass at errors * completed testing of errors * DBN->DDN * finished calling everything DDNs * improved error * made errors a little better * fixed tests on 1.0, added 1.2 to Travis * added nodenames for DDNStructure type, ddn images * added a couple more sentences * added outputnames * minor updates after testing POMDPSimulators against this * removed old deprecations * got rid of references to deprecated functions in the docstring * add history and currentobs to fix #226 * allowed history to be more than `AbstractArray` * added DDNStructureV7 * fixed problem with add_registry * Update get_started.md * @pure annotation for DDNOut and DDNode convenience constructors * added length to spaces interface
I am trying to write an extension for constrained MDPs and realizing the limits of the
generate_x
paradigm that we have been using so far.In addition to the next state, observation, and reward, I need to return a cost
c
. So solvers would use something likegenerate_sorci
. This seems to be moving beyond the happy limits of our habit of naminggenerate
functions like this.I think we should replace this with a single function
gen
.Simple Description
Problem-writer's perspective
Problem writers would implement
which would return a
NamedTuple
with fieldssp
andr
, along witho
for POMDPs, and possibly others likei
for info orc
for the constraint cost.Solver-writer's perspective
Solver writers would use, for example
The first argument specifies what is needed and the order.
Advanced Usage and Implementation Details
Implementation
The function
will be implemented as a generated function in POMDPs.jl to switch around the arguments and throw helpful errors if things are missing.
Optimization by solver-writers
If advanced problem writers want to optimize, they can implement a
gen(::Val{T}, ...)
directly. For example, if they want to use a particle filter and don't want to generate extra observations, they would implementgen(::Val{:sp}, m, s, a, rng)
.Extension
There will be a mechanism to hook into
gen(::Val{T}, ...)
for extensions to provide helpful error messages, etc. for extensions like constrained MDPs.Advantages
NamedTuple
s, and the error message when they don't would be straightforward.generate_x
andgen
with deprecations, etc shouldn't be too painful.gen
that warns once about the deprecation, and then usesgenerate_sor
Disadvantages
Open questions
gen(::Val{:o}, m::POMDP, s, a, sp, rng)
?reward
be used to generater
if it is not already in theNamedTuple
? (I think yes)The text was updated successfully, but these errors were encountered: