<commit_before>package br.uece.tabusearch;

import java.util.List;

import org.apache.commons.collections4.IteratorUtils;

public class TabuSearch {
	
	private TabuList tabuList;
	private StopCondition stopCondition;
	private BestNeighborSolutionLocator solutionLocator;
	
	public TabuSearch(TabuList tabuList, StopCondition stopCondition, BestNeighborSolutionLocator solutionLocator) {
		this.tabuList = tabuList;
		this.stopCondition = stopCondition;
		this.solutionLocator = solutionLocator;
	}
	
	public Solution run(Solution initialSolution) {
		Solution bestSolution = initialSolution;
		Solution currentSolution = initialSolution;
		
		Integer currentIteration = 0;
		while (!stopCondition.mustStop(++currentIteration, bestSolution)) {
			
			List<Solution> candidateNeighbors = currentSolution.getNeighbors();
			List<Solution> solutionsInTabu = IteratorUtils.toList(tabuList.iterator());
			
			Solution bestNeighborFound = solutionLocator.findBestNeighbor(candidateNeighbors, solutionsInTabu);
			if (bestNeighborFound.getValue() < bestSolution.getValue()) {
				bestSolution = bestNeighborFound;
			}
			
			tabuList.add(currentSolution);
			tabuList.updateSize(currentIteration, bestSolution);
		}
		
		return bestSolution;
	}
	
}<commit_msg>Correção na atualização da solução atual do algoritmo<commit_after>package br.uece.tabusearch;

import java.util.List;

import org.apache.commons.collections4.IteratorUtils;

public class TabuSearch {
	
	private TabuList tabuList;
	private StopCondition stopCondition;
	private BestNeighborSolutionLocator solutionLocator;
	
	public TabuSearch(TabuList tabuList, StopCondition stopCondition, BestNeighborSolutionLocator solutionLocator) {
		this.tabuList = tabuList;
		this.stopCondition = stopCondition;
		this.solutionLocator = solutionLocator;
	}
	
	public Solution run(Solution initialSolution) {
		Solution bestSolution = initialSolution;
		Solution currentSolution = initialSolution;
		
		Integer currentIteration = 0;
		while (!stopCondition.mustStop(++currentIteration, bestSolution)) {
			
			List<Solution> candidateNeighbors = currentSolution.getNeighbors();
			List<Solution> solutionsInTabu = IteratorUtils.toList(tabuList.iterator());
			
			Solution bestNeighborFound = solutionLocator.findBestNeighbor(candidateNeighbors, solutionsInTabu);
			if (bestNeighborFound.getValue() < bestSolution.getValue()) {
				bestSolution = bestNeighborFound;
			}
			
			currentSolution = bestNeighborFound;
			
			tabuList.add(currentSolution);
			tabuList.updateSize(currentIteration, bestSolution);
		}
		
		return bestSolution;
	}
	
}
{'fraction_non_alphanumeric': 0.0787037037037037, 'fraction_numerical': 0.0015432098765432098, 'mean_word_length': 5.648717948717949, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '818871', 'n_tokens_mistral': 888, 'n_tokens_neox': 733, 'n_words': 143}