<commit_before>package hmo.project;

import hmo.project.ga.Algorithm;
import hmo.project.ga.Individual;
import hmo.project.ga.Solution;
import hmo.project.ga.SolutionDecoder;
import hmo.project.input.InputFormatReader;
import hmo.project.output.OutputFormatWriter;
import hmo.project.state.State;

import java.io.File;
import java.io.IOException;

public class Main {
	public static void main(String[] args) throws IOException {

		if (args.length != 2) {
			System.err.println("Usage: <inputfile> <outputfile>");
			return;
		}

		final InputFormatReader input = new InputFormatReader(new File(args[0]));

		final State state = input.ReadAll();

		state.CalculateDistances();

		Algorithm alg = new Algorithm(state.vehicles, state.consumers, state.distance, 100, 53, 1000, 2000000, 0.31, 4);
		alg.init();
		alg.run();

		Individual best = alg.getBestIndividual();
		SolutionDecoder decoder = new SolutionDecoder(state.consumers, state.producers, state.distance);
		
		final int[][] warehouseSets = {	
								{0, 1, 2},
								{0, 1, 3},
								{0, 1, 4},
								{0, 2, 3},
								{0, 2, 4},
								{1, 2, 3},
								{1, 2, 4},
								{1, 3, 4}
							};
		
		Solution bestSolution = null;
		double bestCost = Double.MAX_VALUE;
		
		for (final int[] warehouses : warehouseSets) {
			Solution solution = decoder.decode(best, warehouses);
			solution.improve(state.distance, state.producers);
			final double cost = solution.getTotalCost(state.distance, state.producers);
			
			if (cost < bestCost) {
				bestSolution = solution;
				bestCost = cost;
			}
		}

		final OutputFormatWriter output = new OutputFormatWriter(new File(args[1]));

		output.WriteAll(state, bestSolution);
		output.WriteAllToStdout(state, bestSolution);
	}
}<commit_msg>Fix cost type.<commit_after>package hmo.project;

import hmo.project.ga.Algorithm;
import hmo.project.ga.Individual;
import hmo.project.ga.Solution;
import hmo.project.ga.SolutionDecoder;
import hmo.project.input.InputFormatReader;
import hmo.project.output.OutputFormatWriter;
import hmo.project.state.State;

import java.io.File;
import java.io.IOException;

public class Main {
	public static void main(String[] args) throws IOException {

		if (args.length != 2) {
			System.err.println("Usage: <inputfile> <outputfile>");
			return;
		}

		final InputFormatReader input = new InputFormatReader(new File(args[0]));

		final State state = input.ReadAll();

		state.CalculateDistances();

		final Algorithm alg = new Algorithm(state.vehicles, state.consumers, state.distance, 100, 53, 1000, 2000000, 0.31, 4);
		alg.init();
		alg.run();

		final Individual best = alg.getBestIndividual();
		SolutionDecoder decoder = new SolutionDecoder(state.consumers, state.producers, state.distance);
		
		final int[][] warehouseSets = {	
								{0, 1, 2},
								{0, 1, 3},
								{0, 1, 4},
								{0, 2, 3},
								{0, 2, 4},
								{1, 2, 3},
								{1, 2, 4},
								{1, 3, 4}
							};
		
		Solution bestSolution = null;
		int bestCost = Integer.MAX_VALUE;
		
		for (final int[] warehouses : warehouseSets) {
			final Solution solution = decoder.decode(best, warehouses);
			solution.improve(state.distance, state.producers);
			final int cost = solution.getTotalCost(state.distance, state.producers);
			
			if (cost < bestCost) {
				bestSolution = solution;
				bestCost = cost;
			}
		}

		final OutputFormatWriter output = new OutputFormatWriter(new File(args[1]));

		output.WriteAll(state, bestSolution);
		output.WriteAllToStdout(state, bestSolution);
	}
}
{'fraction_non_alphanumeric': 0.13039772727272728, 'fraction_numerical': 0.026704545454545453, 'mean_word_length': 3.614678899082569, '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': '7216853', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1098, 'n_words': 279}