Class VmAllocationPolicySimple
- java.lang.Object
-
- org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicyAbstract
-
- org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicySimple
-
- All Implemented Interfaces:
VmAllocationPolicy
public class VmAllocationPolicySimple extends VmAllocationPolicyAbstract
A VmAllocationPolicy implementation that chooses, as the host for a VM, that one with the fewest PEs in use. It is therefore a Worst Fit policy, allocating each VM into the host with most available PEs.NOTE: This policy doesn't perform optimization of VM allocation by means of VM migration.
- Since:
- CloudSim Toolkit 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
-
-
Field Summary
-
Fields inherited from interface org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicy
NULL
-
-
Constructor Summary
Constructors Constructor Description VmAllocationPolicySimple()
Instantiates a VmAllocationPolicySimple.VmAllocationPolicySimple(BiFunction<VmAllocationPolicy,Vm,Optional<Host>> findHostForVmFunction)
Instantiates a VmAllocationPolicySimple, changing theFunction
to select a Host for a Vm in order to define a different policy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Host>
findHostForVm(Vm vm)
Gets the first suitable host from theVmAllocationPolicyAbstract.getHostList()
that has the fewest number of used PEs (i.e, higher free PEs).-
Methods inherited from class org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicyAbstract
addPesFromHost, addUsedPes, allocateHostForVm, allocateHostForVm, deallocateHostForVm, getDatacenter, getHostFreePesMap, getHostList, getOptimizedAllocationMap, removeUsedPes, scaleVmVertically, setDatacenter, setFindHostForVmFunction, setHostFreePesMap, setUsedPes
-
-
-
-
Constructor Detail
-
VmAllocationPolicySimple
public VmAllocationPolicySimple()
Instantiates a VmAllocationPolicySimple.
-
VmAllocationPolicySimple
public VmAllocationPolicySimple(BiFunction<VmAllocationPolicy,Vm,Optional<Host>> findHostForVmFunction)
Instantiates a VmAllocationPolicySimple, changing theFunction
to select a Host for a Vm in order to define a different policy.- Parameters:
findHostForVmFunction
- aFunction
to select a Host for a given Vm.- See Also:
VmAllocationPolicy.setFindHostForVmFunction(java.util.function.BiFunction)
-
-
Method Detail
-
findHostForVm
public Optional<Host> findHostForVm(Vm vm)
Gets the first suitable host from theVmAllocationPolicyAbstract.getHostList()
that has the fewest number of used PEs (i.e, higher free PEs).
-
-