I am using the future.apply package in my R code to do parallel processing on 100 Monte-Carlo Simulations on an optimization problem.
For now let's assume that the output of the optimization for each simulation is either True (optimal solution found) or False (no optimal solution found). Can I set up condition(s) so that if the first 10 simulations return False, the parallel process will be terminated?
EDIT : I include a small example below - can I terminate this after 10 runs?
library(future.apply)
plan(multiprocess)
outputs <- future_lapply(1:100, function(i){
temp <- FALSE
return(temp)
})