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

zeros in probability in the master build #60

Open
dotkrnl opened this issue Jun 10, 2022 · 1 comment
Open

zeros in probability in the master build #60

dotkrnl opened this issue Jun 10, 2022 · 1 comment

Comments

@dotkrnl
Copy link

dotkrnl commented Jun 10, 2022

When building Dice and rsdd both from the master branch, the following simple example results in all zeros:

let burglary = flip 0.1 in
let alarm = if burglary then flip 9.5 else flip 0.1 in
let _ = observe alarm in burglary

The example above has the output of:

================[ Joint Distribution ]================
Value   Probability
true    0
false   0

To build them from the master branch, the following Dockerfile was used:

FROM ocaml/opam:debian-11-ocaml-4.09

WORKDIR /dice

# Install Python 3.9 and other dependencies
RUN sudo apt-get update && sudo apt-get install python3.9 m4 pkg-config libffi-dev libgmp-dev -y

# Install Rust and Cargo
RUN sh -c "$(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs)" -- -y

# Install Dice dependencies
RUN sudo mkdir -p /dice && sudo chown $(id -un) /dice-python && sudo chown $(id -un) /dice
RUN git clone https://github.com/SHoltzen/dice.git /dice
RUN cd /dice && git submodule update --init --recursive && cd rsdd && git checkout master
RUN cd /dice && opam init && opam install . --deps-only

# Build Dice
RUN /bin/bash -c "cd /dice && eval '$(opam env)' && source $HOME/.cargo/env && dune build"

# Install Dice
RUN /bin/bash -c "cd /dice && eval '$(opam env)' && dune install"
@SHoltzen
Copy link
Owner

Thanks a lot for this very nice bug report! Sorry for the delay, I was traveling.

I was able to identify the issue. The issue is the flip 9.5 on line 2; the flip parameter is greater than 1, which is causing some undefined behavior. If you replace this with flip 0.95, it works as expected.

I will add an error message for this case -- this should cause a syntax error and not simply yield 0 probabilities.

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

2 participants