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

Extend sampling functions to more than one item #837

Open
Tortar opened this issue Jul 25, 2023 · 6 comments
Open

Extend sampling functions to more than one item #837

Tortar opened this issue Jul 25, 2023 · 6 comments
Labels
enhancement New feature or request space interaction api About how a simulation interacts with the space

Comments

@Tortar
Copy link
Member

Tortar commented Jul 25, 2023

Currently we support only single versions of specialized sampling function, but we could support also the multi-versions so that the new function sample without replacement for more than one item

@Tortar Tortar added space interaction api About how a simulation interacts with the space enhancement New feature or request labels Jul 25, 2023
@Tortar Tortar changed the title Extend sampling function to more than one item Extend sampling functions to more than one item Jul 25, 2023
@Tortar
Copy link
Member Author

Tortar commented Sep 10, 2023

I think that here we can even create a new package specialized for these sampling function, the reason is that these sampling function aren't useful only for agent based modeling, they can be used with any iterator

@Tortar
Copy link
Member Author

Tortar commented Jan 14, 2024

created: https://github.com/Tortar/IteratorSampling.jl

it will be be easier to solve this issue with it

@Tortar
Copy link
Member Author

Tortar commented Jan 30, 2024

With iteratorsampling.jl it should be easy to create a fast version of multiple elements sampling functions, the problem is our current naming convetions which assume only one agent e.g. random_agent, random_nearby_agent, do you have any idea on how to handle this @Datseris ?

@Datseris
Copy link
Member

What does multiple elements mean here. what should random_agents mean for multiple elements?

@Tortar
Copy link
Member Author

Tortar commented Jan 30, 2024

say instead of a single random agent, between all nearby agents, you want two of them, currently you either need to repeat (and maybe reject) random_agent two times or collect and sample. Instead if we talk about random_agents(model, n) this would return n random agents in the model. Do you think that "duplicating" random_agent, ecc... with random_agents, ecc... could be acceptable?

@Datseris
Copy link
Member

yes, that would be acceptable. We cross ref the two functions in their docsttrings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request space interaction api About how a simulation interacts with the space
Projects
None yet
Development

No branches or pull requests

2 participants