cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus-examples/src/main/java/org/cloudsimplus/examples/workload/SwfWorkloadFormatExample1.java
private List<Host> createHostsAccordingToVmRequirements() {
        List<Host> hostList = new ArrayList<>();
        Map<Long, Long> vmsPesCountMap = getMapWithNumberOfVmsGroupedByRequiredPesNumber();
        long numberOfPesRequiredByVms, numberOfVms, numberOfVmsRequiringUpToTheMinimumPesNumber = 0;
        long totalOfHosts = 0, totalOfPesOfAllHosts = 0;
        for (Entry<Long, Long> entry: vmsPesCountMap.entrySet()) {
            numberOfPesRequiredByVms = entry.getKey();
            numberOfVms = entry.getValue();
            /*For VMs requiring MINIMUM_NUM_OF_PES_BY_HOST or less PEs,
            it will be created a set of Hosts which all of them contain
            this number of PEs.*/
            if(numberOfPesRequiredByVms <= MINIMUM_NUM_OF_PES_BY_HOST){
                numberOfVmsRequiringUpToTheMinimumPesNumber += numberOfVms;
            }
            else {
                hostList.addAll(createHostsOfSameCapacity(numberOfVms, numberOfPesRequiredByVms));
                totalOfHosts += numberOfVms;
                totalOfPesOfAllHosts += numberOfVms*numberOfPesRequiredByVms;
            }
        }

        totalOfHosts += numberOfVmsRequiringUpToTheMinimumPesNumber;
        totalOfPesOfAllHosts += numberOfVmsRequiringUpToTheMinimumPesNumber*MINIMUM_NUM_OF_PES_BY_HOST;
        List<Host> subList =
                createHostsOfSameCapacity(
                        numberOfVmsRequiringUpToTheMinimumPesNumber,
                        MINIMUM_NUM_OF_PES_BY_HOST);
        hostList.addAll(subList);
        Log.printConcatLine(
                "#Total of created hosts: ", totalOfHosts,
                " Total of PEs of all hosts: ", totalOfPesOfAllHosts);
        Log.printLine();

        return hostList;
    }
/**
     * Creates a list of hosts considering the requirements of the list of VMs.
     *
     * @return
     */
Creates a list of hosts considering the requirements of the list of VMs.
@return
Creates a list of hosts considering the requirements of the list of VMs . @return
private List<Host> createHostsAccordingToVmRequirements() {
        List<Host> hostList = new ArrayList<>();
        Map<Long, Long> vmsPesCountMap = getMapWithNumberOfVmsGroupedByRequiredPesNumber();
        long numberOfPesRequiredByVms, numberOfVms, numberOfVmsRequiringUpToTheMinimumPesNumber = 0;
        long totalOfHosts = 0, totalOfPesOfAllHosts = 0;
        for (Entry<Long, Long> entry: vmsPesCountMap.entrySet()) {
            numberOfPesRequiredByVms = entry.getKey();
            numberOfVms = entry.getValue();
            /*For VMs requiring MINIMUM_NUM_OF_PES_BY_HOST or less PEs,
            it will be created a set of Hosts which all of them contain
            this number of PEs.*/
            if(numberOfPesRequiredByVms <= MINIMUM_NUM_OF_PES_BY_HOST){
                numberOfVmsRequiringUpToTheMinimumPesNumber += numberOfVms;
            }
            else {
                hostList.addAll(createHostsOfSameCapacity(numberOfVms, numberOfPesRequiredByVms));
                totalOfHosts += numberOfVms;
                totalOfPesOfAllHosts += numberOfVms*numberOfPesRequiredByVms;
            }
        }
        totalOfHosts += numberOfVmsRequiringUpToTheMinimumPesNumber;
        totalOfPesOfAllHosts += numberOfVmsRequiringUpToTheMinimumPesNumber*MINIMUM_NUM_OF_PES_BY_HOST;
        List<Host> subList =
                createHostsOfSameCapacity(
                        numberOfVmsRequiringUpToTheMinimumPesNumber,
                        MINIMUM_NUM_OF_PES_BY_HOST);
        hostList.addAll(subList);
        Log.printConcatLine(
                "#Total of created hosts: ", totalOfHosts,
                " Total of PEs of all hosts: ", totalOfPesOfAllHosts);
        Log.printLine();
        return hostList;
    }
private List < Host > createHostsAccordingToVmRequirements ( ) { List < Host > hostList = new ArrayList < > ( ) ; Map < Long , Long > vmsPesCountMap = getMapWithNumberOfVmsGroupedByRequiredPesNumber ( ) ; long numberOfPesRequiredByVms , numberOfVms , numberOfVmsRequiringUpToTheMinimumPesNumber = 0 ; long totalOfHosts = 0 , totalOfPesOfAllHosts = 0 ; for ( Entry < Long , Long > entry : vmsPesCountMap . entrySet ( ) ) { numberOfPesRequiredByVms = entry . getKey ( ) ; numberOfVms = entry . getValue ( ) ; /*For VMs requiring MINIMUM_NUM_OF_PES_BY_HOST or less PEs,
            it will be created a set of Hosts which all of them contain
            this number of PEs.*/ if ( numberOfPesRequiredByVms <= MINIMUM_NUM_OF_PES_BY_HOST ) { numberOfVmsRequiringUpToTheMinimumPesNumber += numberOfVms ; } else { hostList . addAll ( createHostsOfSameCapacity ( numberOfVms , numberOfPesRequiredByVms ) ) ; totalOfHosts += numberOfVms ; totalOfPesOfAllHosts += numberOfVms * numberOfPesRequiredByVms ; } } totalOfHosts += numberOfVmsRequiringUpToTheMinimumPesNumber ; totalOfPesOfAllHosts += numberOfVmsRequiringUpToTheMinimumPesNumber * MINIMUM_NUM_OF_PES_BY_HOST ; List < Host > subList = createHostsOfSameCapacity ( numberOfVmsRequiringUpToTheMinimumPesNumber , MINIMUM_NUM_OF_PES_BY_HOST ) ; hostList . addAll ( subList ) ; Log . printConcatLine ( "#Total of created hosts: " , totalOfHosts , " Total of PEs of all hosts: " , totalOfPesOfAllHosts ) ; Log . printLine ( ) ; return hostList ; }
Creates a list of hosts considering the requirements of the list of VMs.
Creates a list of hosts considering the requirements of the list of VMs .