Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. package jmetal.music;
  2.  
  3. import jmetal.util.JMException;
  4. import jmetal.util.wrapper.XInt;
  5.  
  6. public class Evaluator extends XInt{
  7.  
  8.     public static double evaluateF1(XInt wrappedArray) {
  9.         // TODO Auto-generated method stub
  10.         return 0;
  11.     }
  12.  
  13.     double singingEvents = 0;
  14.  
  15.    
  16.     public double findSingingEvent(XInt wrappedArray) throws JMException{
  17.        
  18.         double numberOfPairs = 0;
  19.         if(getNumberOfDecisionVariables()== 2 && getValue(0) != getValue(1)){
  20.            
  21.             singingEvents++;
  22.         }
  23.    
  24.         for(int index = 0; index < getNumberOfDecisionVariables(); index++){
  25.            
  26.            
  27.             if(getValue(index) == getValue(index + 1)){
  28.                
  29.                 if(index % 2 == 0){numberOfPairs++;}
  30.        
  31.             }  
  32.         }
  33.        
  34.             if(numberOfPairs % 2 == 0){singingEvents++;}
  35.        
  36.         return singingEvents;
  37.    
  38.     }
  39.    
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement