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

add example to README with transition probabilities #33

Open
dave-doty opened this issue Oct 4, 2021 · 2 comments
Open

add example to README with transition probabilities #33

dave-doty opened this issue Oct 4, 2021 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@dave-doty
Copy link
Member

It would be good to have an example on the main README of how to specify probabilities in a transition dictionary, and also how to specify it in a Python function.

@dave-doty dave-doty added the documentation Improvements or additions to documentation label Oct 4, 2021
@EricESeverson
Copy link
Collaborator

There really isn't a good way to specify transition probabilities in a function, as you have to output the entire dictionary of all possible pairs of states and their probabilities.
This really doesn't jive well with trying to write a pseudocode-style function where you modify the fields of agents a / b and would ideally like to write conditional probabilistic statements (like "with probability 0.5, a.minute += 1").

I never settled on a good way around this issue.

@dave-doty
Copy link
Member Author

dave-doty commented Dec 10, 2021

There really isn't a good way to specify transition probabilities in a function, as you have to output the entire dictionary of all possible pairs of states and their probabilities.

What I mean is that you can do this:

def transition(s: int, r: int):
    if s == r and s < 10:
        return { (s,s+1): 0.01 }
    else:
        return max(s,r), max(s,r)

to specify that if s and r are equal, then with probability 1% one of them increments, i.e., although you have to return a dictionary, you can "localize" it to only the part of the protocol that's randomized and just return pairs of states elsewhere. There's currently no examples like this in the README. Note the example also shows that you can make the probabilities sum to less than 1, with the interpretation that the remaining probability is assigned to the null reaction.

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

No branches or pull requests

2 participants