concept.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:ConceptualSpaces 作者: lbechberger 项目源码 文件源码
def size(self):
        """Computes the hypervolume of this concept."""

        hypervolume = 0.0
        num_cuboids = len(self._core._cuboids)

        # use the inclusion-exclusion formula over all the cuboids
        for l in range(1, num_cuboids + 1):
            inner_sum = 0.0

            subsets = list(itertools.combinations(self._core._cuboids, l))           
            for subset in subsets:
                intersection = subset[0]
                for cuboid in subset:
                    intersection = intersection.intersect_with(cuboid)
                inner_sum += self._hypervolume_couboid(intersection)

            hypervolume += inner_sum * (-1.0)**(l+1)

        return hypervolume
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号