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

Cannot use set_value_at2 when block is a dynamically allocated integer? #685

Open
fsaad opened this issue Jan 22, 2018 · 0 comments
Open

Comments

@fsaad
Copy link
Collaborator

fsaad commented Jan 22, 2018

Here is a sample trace, noting that y has dynamic integer scope and string block, whereas z has string scope and dynamic integer block.

$ cat case.vnts
assume x = mem((i) -> tag(i, "x", normal(0, 1)));
assume y = mem((i) -> tag(i, "y", normal(x(i), 1)));
assume z = mem((i) -> tag("z", i, normal(x(i), 1)));
predict y(1);
predict z(1);

Load up the trace, and try set_value_at2 on the random choices in 1:"y" and "z";1 (both of which exist due to the predict statements in case.vnts.

$ venture -if case.vnts
probcomp-1:/scratch/fsaad/cgpm% venture -if case.vnts 
Tracing models with the Lite backend
Initial random seed is 139951036 (to reproduce run, use -s 139951036)
Venture Script, version 0.5.1a20170816.post69+g9304f69.dirty  http://probcomp.csail.mit.edu/venture/  `help' for help
Venture is *alpha quality* software.
Expect occasional crashes that wipe out your console session.
venture[script] case.vnts > set_value_at2(1, "y", 10)
-62.5691647371
venture[script] case.vnts > sample y(1);
10.0
venture[script] case.vnts > set_value_at2("z", 1, 10)
Warning: skipping annotating did 24, assumed to be from the inference prelude
Warning: skipping annotating did 24, assumed to be from the inference prelude
Warning: skipping annotating did 23, assumed to be from the inference prelude
Warning: skipping annotating did 10, assumed to be from the inference prelude
Warning: skipping annotating did 10, assumed to be from the inference prelude
Warning: skipping annotating did 11, assumed to be from the inference prelude
Warning: skipping annotating did 11, assumed to be from the inference prelude
*** evaluation: Tried to propose 1 values, but subproblem accepts 2 values
(autorun (set_value_at2 "z" 1 10))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Caused by
Tried to propose 1 values, but subproblem accepts 2 values
venture[script] case.vnts > 

Hypothesis: The set_value_at2(<scope>, <block>, <value>) procedure will fail if the scope:block identifies more than one random choice. In the test case both 1:"y" and "z";1 actually have two random choices since the invocation of x(i) simulates a normal(0,1), so the semantics imply that set_value_at2 should crash in both cases.

However, set_value_at2 seems to work just fine for the case 1:"y" by setting the "last" random choice, but it fails (as expected, perhaps?) for "z":1.

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