def compute(self, **kwargs):
        """
        Calculate the Roeck measure of compactness.

        @keyword district: A L{District} whose compactness should be 
            computed.
        @keyword plan: A L{Plan} whose district compactnesses should be 
            averaged.
        @keyword version: Optional. The version of the plan, defaults to 
            the most recent version.
        """
        random.seed()
        districts = []
        if 'district' in kwargs:
            districts = [kwargs['district']]
            if districts[0].geom.empty:
                return

        elif 'plan' in kwargs:
            plan = kwargs['plan']
            version = kwargs['version'] if 'version' in kwargs else plan.version
            districts = plan.get_districts_at_version(version, include_geom=True)

        else:
            return

        num = 0
        compactness = 0
        for district in districts:
            if district.district_id == 0:
                continue

            if district.geom.empty:
                continue

            # Convert the coordinates in the convex hull to a list of GEOS Points
            hull = map(lambda x: Point(x[0],x[1]), list(district.geom.convex_hull.coords[0]))
            disk = self.minidisk(hull)

            cir_area = pi * disk.r * disk.r

            compactness += district.geom.area / cir_area
            num += 1

        try:
            self.result = { 'value': num / compactness if num > 0 else 0 }
        except:
            self.result = { 'value': _('n/a') }
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/calculators.py/Roeck.compute/swapped operands of `/`