def process(self, configFile, tempDataDir, inputDir):
        db = self.connect_db(configFile)
        self.read_coord_from_db(db)

        dBucketStationSorted = self.sort_bucket_by_distance(tempDataDir)

        self.get_weight_from_excel(db, inputDir, dBucketStationSorted)
    
        self.write_result(tempDataDir)

        inversePair = InversePair()
        print inversePair.compute_inverse_pair(self.weight)
示例#2
0
 def find_max_benefit_pair(self):
     inversePair = InversePair()
     idx = 0
     idy = 0
     maxValue = 0
     end = self.bn - self.nn
     for i in range(0, end - 1):
         for j in range(i + 1, end):
             self.swap_bucket(i, j)
             a = inversePair.compute_inverse_pair(self.weight)
             self.swap_bucket(i, j)
             b = inversePair.compute_inverse_pair(self.weight)
             if maxValue < b - a:
                 maxValue = b - a
                 idx = i
                 idy = j
     return (idx, idy)
示例#3
0
 def judge_inverse_pair_num(self):
     count = 0
     inversePair = InversePair()
     idx = self.bn - self.nn
     count = inversePair.compute_inverse_pair(self.weight[0:idx])
     return count