@contract
def minimum_migration_time_max_cpu(last_n, vms_cpu, vms_ram):
    min_ram = min(vms_ram.values())
    max_cpu = 0
    selected_vm = None
    for vm, cpu in vms_cpu.items():
        if vms_ram[vm] > min_ram:
            continue
        vals = cpu[-last_n:]
        avg = float(sum(vals)) / len(vals)
        if max_cpu < avg:
            max_cpu = avg
            selected_vm = vm
    return selected_vm
Selects the VM with the minimum RAM and maximum CPU usage.
dataset/ETHPy150Open beloglazov/openstack-neat/neat/locals/vm_selection/algorithms.py/minimum_migration_time_max_cpu