@Test public void scoreTest() { ClusterState testClusterState = getTestClusterState(); List<Vm> vmsInHost1 = new ArrayList<>(); vmsInHost1.add(vm1); List<Vm> vmsInHost2 = new ArrayList<>(); vmsInHost2.add(vm2); mockEnergyModeller(vmsInHost1, vmsInHost2); ScoreCalculatorEnergy scoreCalculatorEnergy = new ScoreCalculatorEnergy(); assertEquals(0, scoreCalculatorEnergy.calculateScore(testClusterState).getHardScore()); assertEquals(-30, scoreCalculatorEnergy.calculateScore(testClusterState).getMediumScore()); }
@Override public HardMediumSoftScore calculateScore(ClusterState solution) { return HardMediumSoftScore.valueOf( calculateHardScore(solution), calculateMediumScore(solution), -VmPlacementConfig.initialClusterState.get().countVmMigrationsNeeded(solution)); }
ScoreCalculatorEnergy implements SimpleScoreCalculator<ClusterState> { @Override public HardMediumSoftScore calculateScore(ClusterState solution) { return HardMediumSoftScore.valueOf( calculateHardScore(solution), calculateMediumScore(solution), -VmPlacementConfig.initialClusterState.get().countVmMigrationsNeeded(solution)); } }
ScoreCalculatorEnergy implements SimpleScoreCalculator<ClusterState> { @Override public HardMediumSoftScore calculateScore(ClusterState solution) { return HardMediumSoftScore.valueOf( calculateHardScore(solution), calculateMediumScore(solution), -VmPlacementConfig.initialClusterState.get().countVmMigrationsNeeded(solution)); }  }
ScoreCalculatorEnergy implements SimpleScoreCalculator<ClusterState> { @Override public HardMediumSoftScore calculateScore(ClusterState solution) { return HardMediumSoftScore.valueOf( calculateHardScore(solution), calculateMediumScore(solution), -VmPlacementConfig.initialClusterState.get().countVmMigrationsNeeded(solution)); }  @Override HardMediumSoftScore calculateScore(ClusterState solution); }
ScoreCalculatorEnergy implements SimpleScoreCalculator<ClusterState> { @Override public HardMediumSoftScore calculateScore(ClusterState solution) { return HardMediumSoftScore.valueOf( calculateHardScore(solution), calculateMediumScore(solution), -VmPlacementConfig.initialClusterState.get().countVmMigrationsNeeded(solution)); }  @Override HardMediumSoftScore calculateScore(ClusterState solution);  }