Skip to content

Rollback activity: infinite loop #22

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

Closed
bart6114 opened this issue Nov 23, 2015 · 2 comments
Closed

Rollback activity: infinite loop #22

bart6114 opened this issue Nov 23, 2015 · 2 comments
Milestone

Comments

@bart6114
Copy link
Member

Some ponderings; maybe it should be possible for a rollback to be infinite, only to be interrupted by the simulation end or a (currently none-existing) skip(times) activity. If #16 would be realised this would allow for a huge amount of flexibility.

@Enchufa2
Copy link
Member

+1000

@Enchufa2
Copy link
Member

Done. Now, you can implement an infinite rollback as follows:

t0 <- create_trajectory() %>% 
  timeout(function() 1) %>%
  rollback(1, times=Inf)

Or, alternatively, you can do the same as follows:

t0 <- create_trajectory() %>% 
  timeout(function() 1) %>%
  rollback(1, check=function() 1)

By specifying the check argument as a function, the times argument is ignored and the rollback activity decides whether to go back or not using this user-defined function, which has great flexibility (and a lot more when #16 is implemented).

@Enchufa2 Enchufa2 added this to the v3.1.0 milestone Dec 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants