Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package algoritmogeneticoelitismo;
- import java.util.ArrayList;
- /**
- *
- * @author Erick
- */
- public class Avaliacao {
- int[][] cromossomos;
- int[] pontuacao;
- ArrayList<Horarios> horarios;
- int fases;
- public Avaliacao(int[][] cromossomos, ArrayList<Horarios> horarios, int fases) {
- this.cromossomos = cromossomos;
- this.horarios = horarios;
- this.pontuacao = new int[cromossomos.length];
- this.fases = fases;
- }
- public void pontuar() {
- for (int x = 0; x < cromossomos.length; x++) {
- int[] choques = new int[fases];
- for (int j = 0; j < 10; j++) {
- for (int i = 0; i < fases; i++) {
- choques[i] = cromossomos[x][(i * 10) + j];
- System.out.println(choques[i]);
- }
- }
- int i = 0;
- Professor[] ps = new Professor[13];
- forHorarios: for (Horarios horario : horarios) {
- if (horario.al.contains((Integer) choques[i])) {
- ps[i] = horario.disciplina.getProfessor();
- i++;
- }
- if(i == 8){
- break forHorarios;
- }
- }
- for (int j = 0; j < ps.length; j++) {
- for (int k = j + 1; k < ps.length; k++) {
- if (ps[j] == ps[k] && ps[j] != null) {
- System.out.println(ps[j]);
- System.out.println("houve choque");
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement