# Run recurrent selection on true breeding values for burn-in 
cat(" Update parents \n")

if(cycle == 1){
  DH <- FoundingDH
}

# Calculate gv for the TPE mean
main_eff <- rowMeans(DH@gv[,-1] %*% t(covs_tpe))

# Select individuals for the TPE mean
DH@misc = list(smth1 = main_eff)
useFunc = function(DH, trait = NULL) DH@misc$smth1 
selParents = selectInd(DH, nSelParents, use = useFunc, simParam = SP)


# Update parents under two possible conditions(nSelParents < nParents or nSelParents == nParents)
if(nSelParents < nParents){
  if(cycle == 1){
  Parents <- FoundingParents
}
Parents <- Parents[(nSelParents+1):nParents]
Parents <- c(Parents, selParents)
}


if(nSelParents == nParents){
Parents <- selParents
}


#=====================================# advance year
F1 <- randCross(Parents, nCrosses)
DH <- makeDH(F1, nDH)




