def get_constraint_matrix(self, hosts, filter_properties):
        num_hosts = len(hosts)
        num_instances = filter_properties.get('num_instances')

        constraint_matrix = [[True for j in xrange(num_instances)]
                            for i in xrange(num_hosts)]

        for i in xrange(num_hosts):
            host_state = copy.deepcopy(hosts[i])
            acceptable_instance_num = self._get_acceptable_instance_num(
                    host_state, filter_properties, num_instances)

            if acceptable_instance_num < num_instances:
                inacceptable_num = num_instances - acceptable_instance_num
                constraint_matrix[i] = (
                        [True for j in xrange(acceptable_instance_num)] +
                        [False for j in xrange(inacceptable_num)])

            LOG.debug("%(host)s can accept %(num)s requested instances "
                        "according to NUMATopologyConstraint.",
                        {'host': hosts[i],
                        'num': acceptable_instance_num})

            numa_topology_limit = host_state.limits.get('numa_topology')
            if numa_topology_limit:
                hosts[i].limits['numa_topology'] = numa_topology_limit

        return constraint_matrix
dataset/ETHPy150Open openstack/nova-solver-scheduler/nova_solverscheduler/scheduler/solvers/constraints/numa_topology_constraint.py/NUMATopologyConstraint.get_constraint_matrix/original