From c844a76b61b4a5ef9101d3fe0fd51163342af582 Mon Sep 17 00:00:00 2001
From: Berkho <alexis.hummel@dauphine.eu>
Date: Wed, 4 Sep 2024 15:34:14 +0200
Subject: [PATCH] float STV

---
 whalrus/rules_committee/rule_stv.py | 10 +++++-----
 whalrus/selections/selection.py     |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/whalrus/rules_committee/rule_stv.py b/whalrus/rules_committee/rule_stv.py
index cef8f14..bbd7716 100644
--- a/whalrus/rules_committee/rule_stv.py
+++ b/whalrus/rules_committee/rule_stv.py
@@ -107,26 +107,26 @@ def get_rounds_(self):
             selection(rule=rule, threshold = self.quota)
 
             for candidate in selection.selected_:
-                elected[candidate] = rule.gross_scores_[candidate]
+                elected[candidate] = float(rule.gross_scores_[candidate])
             
             if not selection.is_above_:
 
                 elimination = EliminationLast(rule=rule, k=1)
                 new_set = elimination.qualified_
                 e = next(iter(elimination.eliminated_))
-                eliminated[e] = rule.gross_scores_[e]
+                eliminated[e] = float(rule.gross_scores_[e])
                 selection = elimination
             else:
                 new_profile = selection.new_profile_
                 new_set = selection.remaining_
             rule(new_profile, candidates=new_set)
-            remaining = {c: rule.gross_scores_[c] for c in new_set}
+            remaining = {c: float(rule.gross_scores_[c]) for c in new_set}
             rounds.append((copy.deepcopy(selection), elected.copy(), remaining,eliminated.copy()))
             if len(rule.candidates_) + len(elected) == self.committee_size:
                 for candidate in rule.candidates_:
-                    elected[candidate] = rule.gross_scores_[candidate]
+                    elected[candidate] = float(rule.gross_scores_[candidate])
                 rounds[-1] = (selection, elected,{}, eliminated)
-
+            
                 return rounds
         return rounds
 
diff --git a/whalrus/selections/selection.py b/whalrus/selections/selection.py
index 8fd9a8c..a17933d 100644
--- a/whalrus/selections/selection.py
+++ b/whalrus/selections/selection.py
@@ -65,13 +65,13 @@ def new_profile_(self):
             
             if len(ballot) >= 1 and ballot.first() not in self.selected_:
                 ballots.append(ballot.restrict(new_set))
-                weights.append(weight)
+                weights.append(float(weight))
             
             elif len(ballot) > 1 and self.get_winner_ratio_[ballot.first()] > 0:
                 
                 ballots.append(ballot.restrict(new_set))
                 weights.append(weight*self.get_winner_ratio_[ballot.first()])
-        
+       
         return Profile(ballots, weights = weights)