OK, so I want to increase the efficency of this R code using multiprocessing only (do not change anything except adding multiprocessing):

mutate <- function(selected_players_df, position_vectors_list, probability) {
  n_rows <- nrow(selected_players_df)
  selected_players_matrix <- selected_players_df
  
  select_random_player <- function(idx_list, selected_players = NULL) {
    repeat {
      random_idx <- sample(idx_list, 1)
      if (!random_idx %in% selected_players) {
        return(random_idx)
      }
    }
  }
  
  for (i in 1:n_rows) {
    for (pos_idx in 1:length(position_vectors_list)) {
      if (runif(1) <= probability) {
        selected_players_matrix[i, pos_idx] <- select_random_player(position_vectors_list[[pos_idx]], 
                                                                    selected_players = selected_players_matrix[i, ])
      }
    }
  }
  
  selected_players_df <- data.frame(selected_players_matrix)
  return(selected_players_df)
}



target <- function(row1,penalty=5) {
  position_ratings <- c("RWRating", "STRating", "GKRating", "CMRating",
                        "LWRating", "CDMRating", "LMRating", "CFRating",
                        "CBRating", "CAMRating", "LBRating", "RBRating",
                        "RMRating", "LWBRating", "RWBRating")
  
  row1<-as.matrix(row1,nrow=1)
  parent_data <- Data[row1, ]
  ratings <- parent_data[position_ratings]
  ratings_log <- log(ratings)
  
  potential_minus_age <- 0.15*parent_data$Potential - 0.6*parent_data$Age
  int_reputation <- parent_data$IntReputation
  
  sumratings<-0
  rating_list<-c()
  for (i in 1:15){
    temp<-ratings_log[i,i]
    sumratings<-sumratings+temp
    rating_list<-append(rating_list, temp)
    
    
  }
  
  
  
  
  # Apply constraints
  constraint_penalty <- 0
  if (sum(parent_data$ValueEUR) > 250000000) {
    constraint_penalty <- constraint_penalty + log((sum(parent_data$ValueEUR)-250000000)^penalty)
  }
  if (sum(parent_data$WageEUR) > 250000) {
    constraint_penalty <- constraint_penalty + log((sum(parent_data$WageEUR)-250000)^penalty)
  }
  if (any(rating_list < 1.2)) {
    constraint_penalty <- constraint_penalty + 1.2^penalty
  }
  
  potential_minus_age
  
  target_value <- -(sumratings+0.3*sum(potential_minus_age) +sum(int_reputation))+constraint_penalty
  
  return(target_value)
}




for (gen in 1:num_generations) {
  
  parent_pop<- as.data.frame(matrix(NA, n_rows, length(position_vectors)))
  for(c in 1:(population_size)){
    parent_pop[c,]<-tournament_selection (parents,t_size=2,penalty=penalty)
    
  }
  
  
  offspring_temp<- as.data.frame(matrix(NA, 1, length(position_vectors)))
  
  for (c in seq(1, population_size, by = 2)){
    parent1<-parent_pop[c,]
    parent2<-parent_pop[c+1,]
    
    offsprings<-crossover(parent1, parent2,corssover_point)
    o1<-unlist(offsprings[1,])
    o2<-unlist(offsprings[2,])
    
    offspring_temp<-rbind(offspring_temp,o1)
    offspring_temp<-rbind(offspring_temp,o2)
    
    
    
  }
  offspring_temp <- offspring_temp[-1, ]
  
  
  
  
  
  parents<- mutate(offspring_temp, position_vectors_list, probability=probability)
  row.names(parents) <- 1:population_size
  solutions<-apply(parents, 1, target)
  idx_sol<-which.min(solutions)[[1]]
  temp_best<-parents[idx_sol[[1]],]
  temp_target_value<-solutions[idx_sol[[1]]]
  
  if(temp_target_value<=global_best_value){
    global_best<-temp_best
    global_best_value<-temp_target_value
    
  }
  
  penalty<-penalty+0.5
  if(penalty>=9){
    penalty<-0
  }
  
}