Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package algoritmogeneticoelitismo;
  7.  
  8. import java.util.ArrayList;
  9.  
  10. /**
  11. *
  12. * @author Erick
  13. */
  14. public class Avaliacao {
  15.  
  16. int[][] cromossomos;
  17. int[] pontuacao;
  18. ArrayList<Horarios> horarios;
  19. int fases;
  20.  
  21. public Avaliacao(int[][] cromossomos, ArrayList<Horarios> horarios, int fases) {
  22. this.cromossomos = cromossomos;
  23. this.horarios = horarios;
  24. this.pontuacao = new int[cromossomos.length];
  25. this.fases = fases;
  26. }
  27.  
  28. public void pontuar() {
  29. for (int x = 0; x < cromossomos.length; x++) {
  30. int[] choques = new int[fases];
  31.  
  32. for (int j = 0; j < 10; j++) {
  33. for (int i = 0; i < fases; i++) {
  34. choques[i] = cromossomos[x][(i * 10) + j];
  35. System.out.println(choques[i]);
  36. }
  37. }
  38. int i = 0;
  39. Professor[] ps = new Professor[13];
  40. forHorarios: for (Horarios horario : horarios) {
  41. if (horario.al.contains((Integer) choques[i])) {
  42. ps[i] = horario.disciplina.getProfessor();
  43. i++;
  44. }
  45. if(i == 8){
  46. break forHorarios;
  47. }
  48. }
  49. for (int j = 0; j < ps.length; j++) {
  50. for (int k = j + 1; k < ps.length; k++) {
  51. if (ps[j] == ps[k] && ps[j] != null) {
  52. System.out.println(ps[j]);
  53. System.out.println("houve choque");
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement