CloudletToVmMappingSolution implements HeuristicSolution<Map<Cloudlet, Vm>> { @Override public double getCost() { recomputeCostIfRequested(); return this.lastCost; } CloudletToVmMappingSolution(final Heuristic heuristic); private  CloudletToVmMappingSolution(final Heuristic heuristic, final Map<Cloudlet, Vm> cloudletVmMap);  CloudletToVmMappingSolution(final CloudletToVmMappingSolution solution); void bindCloudletToVm(final Cloudlet cloudlet, final Vm vm); @Override Heuristic<HeuristicSolution<Map<Cloudlet, Vm>>> getHeuristic(); @Override double getCost(); double getCost(final boolean forceRecompute); double getVmCost(final Map.Entry<Vm, List<Map.Entry<Cloudlet, Vm>>> entry); double getVmCost(final Vm vm, final List<Cloudlet> cloudlets); @Override int compareTo(final HeuristicSolution solution); @Override Map<Cloudlet, Vm> getResult(); static final double MIN_DIFF; }
@Test public void testGetFitness() { final int PES = 2; final int NUMBER_OF_CLOUDLETS = 3; final CloudletToVmMappingSolution instance = createSolutionWithOneVmForEachCloudlet(NUMBER_OF_CLOUDLETS, PES, PES+1); final double expResult = 1.0/3.0; final double result = instance.getFitness(); assertEquals( expResult, result, 0.01, String.format("Fitness is not as expected for the cost %.2f", instance.getCost())); }