@Test public void firstFitDecreasingTest() { List<Host> hosts = new ArrayList<>(); Host host1 = new Host((long) 1, "1", 3, 8192, 8, false); Host host2 = new Host((long) 2, "2", 3, 8192, 8, false); hosts.add(host1); hosts.add(host2); List<Vm> vms = new ArrayList<>(); Vm vm1 = new Vm.Builder((long) 1, 1, 1024, 1).build(); Vm vm2 = new Vm.Builder((long) 2, 2, 1024, 1).build(); Vm vm3 = new Vm.Builder((long) 3, 3, 1024, 1).build(); vms.add(vm1); vms.add(vm2); vms.add(vm3); VmPlacementConfig config = new VmPlacementConfig.Builder( Policy.CONSOLIDATION, 5, ConstructionHeuristic.FIRST_FIT_DECREASING, null, false).build(); ClusterState clusterState = clopla.getBestSolution(hosts, vms, config); List<Vm> solutionVms = clusterState.getVms(); assertEquals(host2, findVmById(solutionVms, 1).getHost()); assertEquals(host2, findVmById(solutionVms, 2).getHost()); assertEquals(host1, findVmById(solutionVms, 3).getHost()); }
@Override public ClusterState getBestSolution(List<Host> hosts, List<Vm> vms, VmPlacementConfig config) { return new VmPlacementProblem(hosts, vms, config).getBestSolution(); }
Clopla implements IClopla { @Override public ClusterState getBestSolution(List<Host> hosts, List<Vm> vms, VmPlacementConfig config) { return new VmPlacementProblem(hosts, vms, config).getBestSolution(); } }
Clopla implements IClopla { @Override public ClusterState getBestSolution(List<Host> hosts, List<Vm> vms, VmPlacementConfig config) { return new VmPlacementProblem(hosts, vms, config).getBestSolution(); }  }
Clopla implements IClopla { @Override public ClusterState getBestSolution(List<Host> hosts, List<Vm> vms, VmPlacementConfig config) { return new VmPlacementProblem(hosts, vms, config).getBestSolution(); }  @Override ClusterState getBestSolution(List<Host> hosts, List<Vm> vms, VmPlacementConfig config); @Override List<ConstructionHeuristic> getConstructionHeuristics(); @Override Map<LocalSearchHeuristic, List<LocalSearchHeuristicOption>> getLocalSearchAlgorithms(); }
Clopla implements IClopla { @Override public ClusterState getBestSolution(List<Host> hosts, List<Vm> vms, VmPlacementConfig config) { return new VmPlacementProblem(hosts, vms, config).getBestSolution(); }  @Override ClusterState getBestSolution(List<Host> hosts, List<Vm> vms, VmPlacementConfig config); @Override List<ConstructionHeuristic> getConstructionHeuristics(); @Override Map<LocalSearchHeuristic, List<LocalSearchHeuristicOption>> getLocalSearchAlgorithms();  }