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

Rollback activity: infinite loop #22

Closed
Bart6114 opened this Issue Nov 23, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@Bart6114
Member

Bart6114 commented Nov 23, 2015

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

This comment has been minimized.

Member

Enchufa2 commented Nov 23, 2015

+1000

@Enchufa2

This comment has been minimized.

Member

Enchufa2 commented Nov 26, 2015

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 closed this Nov 26, 2015

@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