##########################################
#
# Simulation Global Parameters
#
#########################################

#=======================================================================
#### Simulation parameters ####
#=======================================================================
nReps           = 10  # Number of simulation replicates
nCyclesBurnIn   = 5  # Number of simulation cycles
nCyclesFuture   = 5  # Number of simulation cycles

# Trait parameters
MeanG     = 0    # Overall trait mean
nQtl      = 300  # Number of QTLs per chromosome
nChr      = 21

wt = 1        # default weight for lambda (stability)
h2 = 1        # heritability (accuracy) of the main effect for population improvement 

#=======================================================================
##-- Stage-specific parameters
#=======================================================================

# Parents Population Improvement 
nFounders    = 50    # Number of founding parents
nParents     = 50    # Number of parents each generation 
nSelParents  = 50    # Number of parents selected each generation 
nCrosses     = 100   # Number of crosses per year
nDH          = 100   # Number of DH lines produced per cross


# Parents Product Development 
nSelProdDev <- 30                        # Number of parents for product development (this can change depending on prop)
nPairsProdDev <- nSelProdDev/2           # Number of pairs used for product development
nCrossesProdDev <- nPairsProdDev         # Number of crosses 
nDHProdDev <- 50                         # Number of DH per cross for product development



# Define the product development strategies
ProdDevStrat <- c("dcross1.0","dcross0.25",
                  "index1.0", "index0.25", 
                  "mean")


#========================================================================
#---------------------------------------------------#

# This list contains each GEI scenario and the relevant parameters for each scenario
# Specifically:
# k:        Rank of the GEI matrix
# k_maxfit: Number of covariates used in crossing calculations
# p:        Number of environments sampled 
# nEnvTPE:  Number of environments in the TPE (this must equal p for this simulation)

#---------------------------------------------------#

ge_params <- list(
  
  # 2 env
  low2 = list(k = 2, k_maxfit = 2, p = 2, nEnvTPE = 2),
  mod2 = list(k = 2, k_maxfit = 2, p = 2, nEnvTPE = 2),
  high2 = list(k = 2, k_maxfit = 2, p = 2, nEnvTPE = 2),
  
  low2_het = list(k = 2, k_maxfit = 2, p = 2, nEnvTPE = 2),
  mod2_het = list(k = 2, k_maxfit = 2, p = 2, nEnvTPE = 2),
  high2_het = list(k = 2, k_maxfit = 2, p = 2, nEnvTPE = 2),
  
  
  # 3 env
  low3 = list(k = 3, k_maxfit = 3, p = 3, nEnvTPE = 3),
  mod3 = list(k = 3, k_maxfit = 3, p = 3, nEnvTPE = 3),
  high3 = list(k = 3, k_maxfit = 3, p = 3, nEnvTPE = 3),
  
  low3_het = list(k = 3, k_maxfit = 3, p = 3, nEnvTPE = 3),
  mod3_het = list(k = 3, k_maxfit = 3, p = 3, nEnvTPE = 3),
  high3_het = list(k = 3, k_maxfit = 3, p = 3, nEnvTPE = 3),
  
  
  # 4 env
  low4 = list(k = 4, k_maxfit = 4, p = 4, nEnvTPE = 4),
  mod4 = list(k = 4, k_maxfit = 4, p = 4, nEnvTPE = 4),
  high4 = list(k = 4, k_maxfit = 4, p = 4, nEnvTPE = 4),
  
  low4_het = list(k = 4, k_maxfit = 4, p = 4, nEnvTPE = 4),
  mod4_het = list(k = 4, k_maxfit = 4, p = 4, nEnvTPE = 4),
  high4_het = list(k = 4, k_maxfit = 4, p = 4, nEnvTPE = 4),
  
  
  # 10 env
  
  low10 = list(k = 5, k_maxfit = 5, p = 10, nEnvTPE = 10),
  mod10 = list(k = 5, k_maxfit = 5, p = 10, nEnvTPE = 10),
  high10 = list(k = 5, k_maxfit = 5, p = 10, nEnvTPE = 10),
  
  low10_het = list(k = 5, k_maxfit = 5, p = 10, nEnvTPE = 10),
  mod10_het = list(k = 5, k_maxfit = 5, p = 10, nEnvTPE = 10),
  high10_het = list(k = 5, k_maxfit = 5, p = 10, nEnvTPE = 10),
  
  
  # 20 env
  low20 = list(k = 7, k_maxfit = 5, p = 20, nEnvTPE = 20),
  mod20 = list(k = 7, k_maxfit = 5, p = 20, nEnvTPE = 20),
  high20 = list(k = 7, k_maxfit = 5, p = 20, nEnvTPE = 20),
  
  low20_het = list(k = 7, k_maxfit = 5, p = 20, nEnvTPE = 20),
  mod20_het = list(k = 7, k_maxfit = 5, p = 20, nEnvTPE = 20),
  high20_het = list(k = 7, k_maxfit = 5, p = 20, nEnvTPE = 20),
  
  
  # 50 env
  low50 = list(k = 7, k_maxfit = 5, p = 50, nEnvTPE = 50),
  mod50 = list(k = 7, k_maxfit = 5, p = 50, nEnvTPE = 50),
  high50 = list(k = 7, k_maxfit = 5, p = 50, nEnvTPE = 50),
  
  low50_het = list(k = 7, k_maxfit = 5, p = 50, nEnvTPE = 50),
  mod50_het = list(k = 7, k_maxfit = 5, p = 50, nEnvTPE = 50),
  high50_het = list(k = 7, k_maxfit = 5, p = 50, nEnvTPE = 50)
)

