Fix bug with constraints

Also initialise constraint matrix with total number of seats
This commit is contained in:
RunasSudo 2021-06-27 22:36:50 +10:00
parent ba3db26263
commit 05ec70830f
No known key found for this signature in database
GPG Key ID: 7234E476BF21C61A
1 changed files with 5 additions and 0 deletions

View File

@ -236,6 +236,11 @@ impl<'a, N: Number> CountState<'a, N> {
cm.init();
//println!("{}", cm);
// Require correct number of candidates to be elected
let idx = vec![0; constraints.0.len()];
cm[&idx].min = election.seats;
cm[&idx].max = election.seats;
state.constraint_matrix = Some(cm);
}