Input: policy (FF, BF, FFD, BFD), host capacity cpu mem, then VMs name cpu mem until the end of input. Hosts are identical and opened on demand.
- FF: the first open host where the VM fits (CPU and memory); otherwise open a new host.
- BF: among hosts where it fits, the one with the smallest remaining normalized space after placement: (remCpu − cpu)/capCpu + (remMem − mem)/capMem; ties → lowest index.
- FFD / BFD: first sort VMs by their dominant demand max(cpu/capCpu, mem/capMem), largest first (stable for ties), then apply FF / BF.
- A VM larger than a host prints
X -> REJECTED (larger than a host)(it still counts in the lower bound).
Print A -> H1 per VM (in placement order), then for each host H1 [A, B, E] cpu 8/10 (80%), mem 14/32 (44%), then FF: 4 hosts (lower bound 3), power 850 W, where the lower bound is ⌈max(ΣCPU/capCpu, ΣMem/capMem)⌉ and each host draws 100 + 150 × CPU utilization watts.