Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package timetablingsystem;
- import java.util.ArrayList;
- import java.util.List;
- /**
- *
- * @author ASUS
- */
- public class FitnessValue {
- Object[][] tt;
- int Fitness;
- int Rsize;
- int Psize;
- int dataset;
- int accumulation = 0;
- Object[] CM;
- List<String[]> iw;
- List<String[]> p;
- List<String[]> aa;
- public FitnessValue(Object[][] tt, Object[] CM, List<String[]> iw, List<String[]> p, int Psize, int Rsize, List<String[]> aa){
- this.tt = tt;
- this.CM = CM;
- this.iw = iw;
- this.p = p;
- this.Psize = Psize;
- this.Rsize = Rsize;
- this.aa = aa;
- }
- public void PeriodSpread(){
- int examnumber = 0;
- int spread = Integer.parseInt(iw.get(2)[1].trim());
- for(int y = 0; y < Psize; y++){
- List<Integer> col1 = new ArrayList<>();
- List<Integer> col2 = new ArrayList<>();
- if(y + spread >= Psize){
- }
- else{
- for(int x = 0; x < Rsize; x++){
- if(tt[x][y] != null){
- List templist = (List) tt[x][y];
- for(int j = 0; j < templist.size(); j++){
- if(templist.get(j) != null){
- examnumber = (int) templist.get(j);
- col1.add(examnumber);
- }
- }
- }
- if(tt[x][y+spread] != null){
- List templist2 = (List) tt[x][y+spread];
- for(int j = 0; j < templist2.size(); j++){
- if(templist2.get(j) != null){
- examnumber = (int) templist2.get(j);
- col2.add(examnumber);
- }
- }
- }
- }
- }
- for(int i = 0; i < col1.size(); i++){
- for(int j = 0; j < col2.size(); j++){
- accumulation += Integer.parseInt(aa.get(col1.get(i))[col2.get(j)].trim());
- }
- }
- }
- System.out.print("Accumulation = " +accumulation);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement