Buggy code:
public class Genetic extends EvolAlgorithms { public static ArrayList < ArrayList < Integer > > population ; private int maxIteration ; private String crossOverMethod ; private int maxFitnessSoFar = 0 ; private ArrayList < Integer > bestSolution ; private double crossOverProb ; private double mutateProb ; private int winners ; private int sample ; private boolean foundSATSolution = false ; private double boltzmannSum ; private long endTime ; private long timeout = Long . MAX_VALUE ; private int optimalUnSat = Integer . MAX_VALUE ; public Genetic ( int popSize , int literalNumber , int maxIteration , String crossOverMethod , double crossOverProb , double mutateProb , ArrayList < ArrayList < Integer > > satProblem ) { } public Genetic ( int popSize , int literalNumber , int maxIteration , String crossOverMethod , double crossOverProb , double mutateProb , ArrayList < ArrayList < Integer > > satProblem , long timeout , int optimalUnSat ) { } public Results evolve ( String selectionMethod ) { long startTime = System . currentTimeMillis ( ) ; for ( int i = 0 ; ( i < ( maxIteration ) ) && ( ! ( foundSATSolution ) ) ; i ++ ) { currentGeneration = i + 1 ; if ( ( selectionMethod . equalsIgnoreCase ( "rs" ) ) || ( selectionMethod . equalsIgnoreCase ( "bs" ) ) ) { rankBoltzSelect ( selectionMethod ) ; } else { tournamentSelect ( ) ; } if ( foundSATSolution ) { System . out . println ( "Fully<seq2seq4repair_space>Satisfied<seq2seq4repair_space>All<seq2seq4repair_space>Clauses" ) ; break ; } if ( crossOverMethod . equalsIgnoreCase ( "1c" ) ) { singlePointCrossover ( crossOverProb ) ; } else { uniformCrossover ( crossOverProb ) ; } mutate ( mutateProb ) ; int currentUnsat = ( satProblem . size ( ) ) - ( maxFitnessSoFar ) ; <START_BUG> if ( ( ( ( endTime ) - startTime ) > ( timeout ) ) || ( currentUnsat <= ( optimalUnSat ) ) ) { <END_BUG> foundSATSolution = true ; break ; } } long executionTime = ( endTime ) - startTime ; double percent = ( ( ( double ) ( maxFitnessSoFar ) ) * 100 ) // ( ( double ) ( satProblem . size ( ) ) ) ; System . out . println ( "Genetic<seq2seq4repair_space>Algorithm<seq2seq4repair_space>Output:" ) ; System . out . println ( ( "Number<seq2seq4repair_space>Of<seq2seq4repair_space>Variables:<seq2seq4repair_space>" + ( Genetic . population . get ( 0 ) . size ( ) ) ) ) ; System . out . println ( ( "Number<seq2seq4repair_space>Of<seq2seq4repair_space>Clauses:<seq2seq4repair_space>" + ( satProblem . size ( ) ) ) ) ; System . out . println ( ( ( ( ( ( ( "Satisfied<seq2seq4repair_space>Clauses:<seq2seq4repair_space>" + ( maxFitnessSoFar ) ) + "<seq2seq4repair_space>out<seq2seq4repair_space>of<seq2seq4repair_space>" ) + ( satProblem . size ( ) ) ) + "<seq2seq4repair_space>(" ) + ( ( satProblem . size ( ) ) - ( maxFitnessSoFar ) ) ) + "<seq2seq4repair_space>unsatisfied<seq2seq4repair_space>clauses)." ) ) ; System . out . println ( ( "Best<seq2seq4repair_space>Variable<seq2seq4repair_space>Assignment:<seq2seq4repair_space>" + ( Arrays . toString ( binaryToNumber ( bestSolution ) ) ) ) ) ; System . out . println ( ( ( "Percent<seq2seq4repair_space>satisfied:<seq2seq4repair_space>" + percent ) + "%" ) ) ; System . out . println ( ( "Best<seq2seq4repair_space>Generation:" + ( bestGeneration ) ) ) ; System . out . println ( ( ( "Total<seq2seq4repair_space>execution<seq2seq4repair_space>time:<seq2seq4repair_space>" + executionTime ) + "<seq2seq4repair_space>milliseconds" ) ) ; Results result = new Results ( "Genetic<seq2seq4repair_space>Algorithm" , Genetic . population . get ( 0 ) . size ( ) , satProblem . size ( ) , executionTime , ( ( satProblem . size ( ) ) - ( maxFitnessSoFar ) ) , percent , binaryToNumber ( bestSolution ) , bestGeneration ) ; return result ; } private void updateMaxFitness ( int fitness , ArrayList < Integer > values ) { } private void tournamentSelect ( ) { } private ArrayList < ArrayWithFitness > getFitnessForAllIndividuals ( ) { } private void rankBoltzSelect ( String option ) { } private double probFromRank ( double rank , double popsize ) { } private double probFromBoltz ( int index , ArrayList < ArrayWithFitness > popWithFitness ) { } private void calcBoltzmannSum ( ArrayList < ArrayWithFitness > popWithFitness ) { } private void mutate ( double mutateProb ) { } private void singlePointCrossover ( double crossProb ) { } private void uniformCrossover ( double crossProb ) { } public ArrayList < ArrayList < Integer > > initPopulation ( int popSize , int literalNumber ) { } private int [ ] binaryToNumber ( ArrayList < Integer > solution ) { } }

Fix:
if ( ( ( ( System . currentTimeMillis ( ) ) - startTime ) > ( timeout ) ) || ( currentUnsat <= ( optimalUnSat ) ) ) {