diff --git a/1C_Run_Simulation_Upper_Bound.r b/1C_Run_Simulation_Upper_Bound.r index c7665e6..19ae439 100644 --- a/1C_Run_Simulation_Upper_Bound.r +++ b/1C_Run_Simulation_Upper_Bound.r @@ -167,7 +167,7 @@ SINGLE_SIM <- function(DEMO,BIRTH_DATA,ST_YEAR,YEARS_AHEAD,MIGRATION_ARIMA_MODEL NCORES <- detectCores()-1 BATCH_SIZE <- NCORES*10 - TOTAL_SIMULATIONS <- 10^6 + TOTAL_SIMULATIONS <- 10^5 N_RUNS <-ceiling(TOTAL_SIMULATIONS/BATCH_SIZE ) SIM_RES_FILE <- paste0(RES_SIM_DIR,"Kemmerer_2024_Upper_Bound_With_Data_Center_Simulation.csv") diff --git a/1D_Run_Simulation_Lower_Bound.r b/1D_Run_Simulation_Lower_Bound.r index e00210d..0b19887 100644 --- a/1D_Run_Simulation_Lower_Bound.r +++ b/1D_Run_Simulation_Lower_Bound.r @@ -167,10 +167,10 @@ SINGLE_SIM <- function(DEMO,BIRTH_DATA,ST_YEAR,YEARS_AHEAD,MIGRATION_ARIMA_MODEL NCORES <- detectCores()-1 BATCH_SIZE <- NCORES*10 - TOTAL_SIMULATIONS <- 10^6 + TOTAL_SIMULATIONS <- 10^5 N_RUNS <-ceiling(TOTAL_SIMULATIONS/BATCH_SIZE ) - SIM_RES_FILE <- paste0(RES_SIM_DIR,"Kemmerer_2024_With_Lower_Bound_With_Data_Center_Simulation.csv") + SIM_RES_FILE <- paste0(RES_SIM_DIR,"Kemmerer_2024_Lower_Bound_With_Data_Center_Simulation.csv") NEW_RES_FILE <- !file.exists(SIM_RES_FILE) OPERATOR_LIN_MIGRATION <- OPERATORS %>% pull("Operator_Emp_Migrated") CONSTRUCTION_LIN_MIGRATION <- CONSTRUCTION %>% pull("Construction_Emp_Migrated") diff --git a/2D_Lower_Bound_Result_Analysis.r b/2D_Lower_Bound_Result_Analysis.r index 76a7bb8..a74a739 100644 --- a/2D_Lower_Bound_Result_Analysis.r +++ b/2D_Lower_Bound_Result_Analysis.r @@ -6,7 +6,7 @@ source("Scripts/Load_Custom_Functions/Fan_Chart_Creation_Functions.r") #Function ###Process the simulations and save the main percentile results by year - RES <- read_csv("Results/Simulations/Kemmerer_2024_With_Lower_Bound_With_Data_Center_Simulation.csv") + RES <- read_csv("Results/Simulations/Kemmerer_2024_Lower_Bound_With_Data_Center_Simulation.csv") RES[,"Year"] <- RES[,"Year"] RES<- RES %>% filter(!is.na(Year)) RES <- RES %>% filter(!is.na(Population)) diff --git a/Check_Simulation_Counts.r b/Check_Simulation_Counts.r new file mode 100644 index 0000000..a08e2d6 --- /dev/null +++ b/Check_Simulation_Counts.r @@ -0,0 +1,5 @@ +library(tidyverse) +read_csv("Kemmerer_2016_Simulation.csv") %>% filter(!is.na(Population),!is.na(Sim_UUID),!is.na(Year)) %>% pull(Sim_UUID) %>% unique %>% length()/10^5 +read_csv("Kemmerer_2024_Upper_Bound_With_Data_Center_Simulation.csv") %>% filter(!is.na(Population),!is.na(Sim_UUID),!is.na(Year)) %>% pull(Sim_UUID) %>% unique %>% length()/10^5 +read_csv("Kemmerer_2024_With_Lower_Bound_With_Data_Center_Simulation.csv") %>% filter(!is.na(Population),!is.na(Sim_UUID),!is.na(Year)) %>% pull(Sim_UUID) %>% unique %>% length()/10^5 +read_csv("Kemmerer_2024_With_Data_Center_Simulation.csv") %>% filter(!is.na(Population),!is.na(Sim_UUID),!is.na(Year)) %>% pull(Sim_UUID) %>% unique %>% length()/10^5 diff --git a/Run_Simulations.sh b/Run_Simulations.sh index ba2340e..621b1a3 100644 --- a/Run_Simulations.sh +++ b/Run_Simulations.sh @@ -1,21 +1,9 @@ #Run all simulations as needed. Comment out to skip any. All but the primary results have 10^5 simulations echo "Starting all model Simulations. This will take a while!!" -#start_time=$(date +%s) -#Rscript 1A_Run_Full_Simulation_2016.r -#echo "Pre-2016 data simulations for benchmark complete! 100k simulations total" -# Your command or script here -#end_time=$(date +%s) -#elapsed_seconds=$((end_time - start_time)) -#hours=$((elapsed_seconds / 3600)) -#minutes=$(( (elapsed_seconds % 3600) / 60 )) -#seconds=$(( elapsed_seconds % 60 )) -#printf "Execution time: %02d hours, %02d minutes, %02d seconds\n" "$hours" "$minutes" "$seconds" - - start_time=$(date +%s) -Rscript 1C_Run_Simulation_Upper_Bound.r -echo "Upper bound migration with county average migration rates complete! 100k simulations total" +Rscript 1A_Run_Full_Simulation_2016.r +echo "Pre-2016 data simulations for benchmark complete! 100k simulations total" end_time=$(date +%s) elapsed_seconds=$((end_time - start_time)) hours=$((elapsed_seconds / 3600)) @@ -24,6 +12,17 @@ seconds=$(( elapsed_seconds % 60 )) printf "Execution time: %02d hours, %02d minutes, %02d seconds\n" "$hours" "$minutes" "$seconds" +#start_time=$(date +%s) +#Rscript 1C_Run_Simulation_Upper_Bound.r +#echo "Upper bound migration with county average migration rates complete! 100k simulations total" +#end_time=$(date +%s) +#elapsed_seconds=$((end_time - start_time)) +#hours=$((elapsed_seconds / 3600)) +#minutes=$(( (elapsed_seconds % 3600) / 60 )) +#seconds=$(( elapsed_seconds % 60 )) +#printf "Execution time: %02d hours, %02d minutes, %02d seconds\n" "$hours" "$minutes" "$seconds" + + start_time=$(date +%s) Rscript 1D_Run_Simulation_Lower_Bound.r echo "Lower bound migration with Kemmerere average migration rates complete! 100k simulations total" @@ -46,3 +45,18 @@ minutes=$(( (elapsed_seconds % 3600) / 60 )) seconds=$(( elapsed_seconds % 60 )) printf "Execution time: %02d hours, %02d minutes, %02d seconds\n" "$hours" "$minutes" "$seconds" +start_time=$(date +%s) +Rscript 1D_Run_Simulation_Lower_Bound.r +Rscript 1D_Run_Simulation_Lower_Bound.r +Rscript 1A_Run_Full_Simulation_2016.r +Rscript 1A_Run_Full_Simulation_2016.r +Rscript 1D_Run_Simulation_Lower_Bound.r +Rscript 1A_Run_Full_Simulation_2016.r +echo "Extra simulations complete! 600k simulations total" +end_time=$(date +%s) +elapsed_seconds=$((end_time - start_time)) +hours=$((elapsed_seconds / 3600)) +minutes=$(( (elapsed_seconds % 3600) / 60 )) +seconds=$(( elapsed_seconds % 60 )) +printf "Execution time: %02d hours, %02d minutes, %02d seconds\n" "$hours" "$minutes" "$seconds" +