Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. vector<int> crear_individuo(int days, int nurses, vector<vector<int> > c_matrix){
  2. vector<vector<int> > c_matrix_aux;
  3. vector<int> individuo(days*nurses, -1);
  4.  
  5. for (int i = 0; i < days; i++){
  6. for(int j = 0; j < 4; j++){
  7. //turno = rand() % 4;
  8. while(c_matrix[i][j] > 0){
  9. int enfermera = rand() % (nurses - 1);
  10. while(individuo[enfermera + (i*nurses)] != -1){
  11. enfermera = rand() % (nurses - 1);
  12. }
  13. individuo[enfermera + (i*nurses)] = j;
  14. c_matrix[i][j] -= 1;
  15. }
  16. //individuo.push_back(turno);
  17.  
  18. }
  19. }
  20.  
  21. return individuo;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement