fix bug in num_instances_per_host_consrtaint, need more tests.