def get_results(self):
     for f in self.parent.upper_frame.right_frame.list_files:
         structure = read_file(join("Data/all", f), f in listFiles)
         if self.parent.upper_frame.left_frame.algo.get() == 0:
             preferences = structure["preferences"]
             if self.parent.upper_frame.left_frame.filtered.get():
                 preferences, nb_voters, nb_unique = remove_last_ballots(
                     preferences)
             candidates = structure["candidates"]
             ensemble, best = bnb(len(preferences), preferences, candidates)
             axes, card = find_axes2(best[0][0], candidates)
             axes = filter_symmetric_axes(axes)
             for axis in axes:
                 self.results.append((f, axis))
         else:
             if self.parent.upper_frame.left_frame.dissimilarity.get() == 0:
                 dissimilarity_function = dissimilarity_and_n
             elif self.parent.upper_frame.left_frame.dissimilarity.get(
             ) == 1:
                 dissimilarity_function = dissimilarity_and_or
             else:
                 dissimilarity_function = dissimilarity_over_over
             if f in listFiles:
                 t, permutations = find_axis_from_structure(
                     structure, dissimilarity_function,
                     self.parent.upper_frame.left_frame.weighted.get())
             else:
                 t, permutations = find_axis_from_structure(
                     structure,
                     dissimilarity_function,
                     self.parent.upper_frame.left_frame.weighted.get(),
                     unwanted_candidates=[2, 3, 7, 11])
             permutations = filter_symmetric_axes(permutations[1])
             for permutation in permutations:
                 self.results.append((f, permutation))
Exemplo n.º 2
0
 def get_results(self):
     for f in self.parent.upper_frame.right_frame.list_files:
         structure = read_file(join("Data/all", f), f in listFiles)
         if self.parent.upper_frame.left_frame.algo.get() == 0:
             preferences = structure["preferences"]
             if self.parent.upper_frame.left_frame.filtered.get():
                 preferences, nb_voters, nb_unique = remove_last_ballots(preferences)
             candidates = structure["candidates"]
             ensemble, best = bnb(len(preferences), preferences, candidates)
             axes, card = find_axes2(best[0][0], candidates)
             axes = filter_symmetric_axes(axes)
             for axis in axes:
                 self.results.append((f, axis))
         else:
             if self.parent.upper_frame.left_frame.dissimilarity.get() == 0:
                 dissimilarity_function = dissimilarity_and_n
             elif self.parent.upper_frame.left_frame.dissimilarity.get() == 1:
                 dissimilarity_function = dissimilarity_and_or
             else:
                 dissimilarity_function = dissimilarity_over_over
             if f in listFiles:
                 t, permutations = find_axis_from_structure(structure, dissimilarity_function,
                                                            self.parent.upper_frame.left_frame.weighted.get())
             else:
                 t, permutations = find_axis_from_structure(structure, dissimilarity_function,
                                                            self.parent.upper_frame.left_frame.weighted.get(),
                                                            unwanted_candidates=[2, 3, 7, 11])
             permutations = filter_symmetric_axes(permutations[1])
             for permutation in permutations:
                 self.results.append((f, permutation))
Exemplo n.º 3
0
def calculate_seriation(self, file, vrow, dissimilarity, weighted):
    structure = read_file("Data/all/" + str(file), file in listFiles)
    Label(self, text=str(structure["nb_voters"])).grid(row=vrow, column=3)
    Label(self, text=str(structure["nb_unique_orders"])).grid(row=vrow, column=5)
    if file in listFiles:
        t, axes = find_axis_from_structure(structure, dissimilarity, weighted)
    else:
        t, axes = find_axis_from_structure(structure, dissimilarity, weighted, unwanted_candidates=[2, 3, 7, 11])
    Label(self, text=str(len(axes[1]))).grid(row=vrow, column=7)
    Label(self, text=str(t)).grid(row=vrow, column=9)
Exemplo n.º 4
0
def calculate_seriation(self, file, vrow, dissimilarity, weighted):
    structure = read_file("Data/all/" + str(file), file in listFiles)
    Label(self, text=str(structure["nb_voters"])).grid(row=vrow, column=3)
    Label(self, text=str(structure["nb_unique_orders"])).grid(row=vrow,
                                                              column=5)
    if file in listFiles:
        t, axes = find_axis_from_structure(structure, dissimilarity, weighted)
    else:
        t, axes = find_axis_from_structure(structure,
                                           dissimilarity,
                                           weighted,
                                           unwanted_candidates=[2, 3, 7, 11])
    Label(self, text=str(len(axes[1]))).grid(row=vrow, column=7)
    Label(self, text=str(t)).grid(row=vrow, column=9)