private HashMap<Integer, HashMap<Integer, ArrayList<Integer>>> createGiantTourChromosome( HashMap<Integer, Set<Integer>> installationDepartureChromosome, HashMap<Integer, Set<Integer>> vesselDepartureChromosome) { HashMap<Integer, Set<Integer>> reversedInstallationChromosome = Utilities.getReversedHashMap( installationDepartureChromosome); // the key is a period/day and the Set<Integer> is a // set of installation numbers HashMap<Integer, Set<Integer>> reversedVesselChromosome = Utilities.getReversedHashMap( vesselDepartureChromosome); // the key is a period/day, and the Set<Integer> is a set of // vessel numbers int nDays = problemData.getLengthOfPlanningPeriod(); int nVessels = problemData.getVessels().size(); // initializing HashMap<Integer, HashMap<Integer, ArrayList<Integer>>> giantTourChromosome = GenotypeHGS.generateEmptyGiantTourChromosome(nDays, nVessels); // allocating for (Integer day : reversedInstallationChromosome.keySet()) { Set<Integer> installationsToAllocate = reversedInstallationChromosome.get(day); Set<Integer> availableVessels = reversedVesselChromosome.get(day); HashMap<Integer, ArrayList<Integer>> vesselAllocations = giantTourChromosome.get(day); for (Integer installation : installationsToAllocate) { Integer randomVessel = Utilities.pickRandomElementFromSet(availableVessels); ArrayList<Integer> existingInstallations = vesselAllocations.get(randomVessel); existingInstallations.add(installation); vesselAllocations.put(randomVessel, existingInstallations); } giantTourChromosome.put(day, vesselAllocations); } // shuffle sequence of visits for (Integer day : giantTourChromosome.keySet()) { for (Integer vessel : giantTourChromosome.get(day).keySet()) { ArrayList<Integer> installationsToVisit = giantTourChromosome.get(day).get(vessel); Collections.shuffle(installationsToVisit); } } return giantTourChromosome; }