pub fn read_raw_data_checking_against_official_transcript_to_deduce_ec_resolutions<Rules:PreferenceDistributionRules<Tally=usize>>(&self, electorate: &str) -> anyhow::Result<ElectionData>  {
        let mut data = self.read_raw_data(electorate)?;
        if electorate.ends_with("Mayoral") { return Ok(data); } // don't have DOP file for mayoral elections. Besides, STV is not necessarily exactly a generalization of IRV... e.g. early termination conditions.
        // let mut tie_resolutions = TieResolutionsMadeByEC::default();
        let official_transcript = self.read_official_dop_transcript(&data.metadata)?;
        loop {
            let transcript = distribute_preferences::<Rules>(&data, data.metadata.vacancies.unwrap(), &data.metadata.excluded.iter().cloned().collect(), &data.metadata.tie_resolutions, false);
            if let Some((favoured_candidate, unfavoured_candidate)) = official_transcript.compare_with_transcript_checking_for_ec_decisions(&transcript, decode,false) {
                println!("Observed tie resolution favouring {} over {}", favoured_candidate, unfavoured_candidate);
                assert!(favoured_candidate.0 < unfavoured_candidate.0, "favoured candidate should be lower as higher candidates are assumed favoured.");
                if data.metadata.tie_resolutions.tie_resolutions.contains(&vec![unfavoured_candidate, favoured_candidate]) {
                    panic!("That tie resolution is already in the list.")
                }
                data.metadata.tie_resolutions.tie_resolutions.push(vec![unfavoured_candidate, favoured_candidate]);
            } else {
                return Ok(data);
            }
        }
    }
/// Like read_raw_data, except also try to deduce the tie breaking decisions that were used by NSWEC.
/// This is a powerful function, but it will be slow and panic if anything goes even slightly wrong.
Like read_raw_data, except also try to deduce the tie breaking decisions that were used by NSWEC.
This is a powerful function, but it will be slow and panic if anything goes even slightly wrong.
Like read_raw_data except also try to deduce the tie breaking decisions that were used by NSWEC . This is a powerful function but it will be slow and panic if anything goes even slightly wrong .
pub fn read_raw_data_checking_against_official_transcript_to_deduce_ec_resolutions<Rules:PreferenceDistributionRules<Tally=usize>>(&self, electorate: &str) -> anyhow::Result<ElectionData>  {
        let mut data = self.read_raw_data(electorate)?;
        if electorate.ends_with("Mayoral") { return Ok(data); } // don't have DOP file for mayoral elections. Besides, STV is not necessarily exactly a generalization of IRV... e.g. early termination conditions.
        // let mut tie_resolutions = TieResolutionsMadeByEC::default();
        let official_transcript = self.read_official_dop_transcript(&data.metadata)?;
        loop {
            let transcript = distribute_preferences::<Rules>(&data, data.metadata.vacancies.unwrap(), &data.metadata.excluded.iter().cloned().collect(), &data.metadata.tie_resolutions, false);
            if let Some((favoured_candidate, unfavoured_candidate)) = official_transcript.compare_with_transcript_checking_for_ec_decisions(&transcript, decode,false) {
                println!("Observed tie resolution favouring {} over {}", favoured_candidate, unfavoured_candidate);
                assert!(favoured_candidate.0 < unfavoured_candidate.0, "favoured candidate should be lower as higher candidates are assumed favoured.");
                if data.metadata.tie_resolutions.tie_resolutions.contains(&vec![unfavoured_candidate, favoured_candidate]) {
                    panic!("That tie resolution is already in the list.")
                }
                data.metadata.tie_resolutions.tie_resolutions.push(vec![unfavoured_candidate, favoured_candidate]);
            } else {
                return Ok(data);
            }
        }
    }
pub fn read_raw_data_checking_against_official_transcript_to_deduce_ec_resolutions < Rules : PreferenceDistributionRules < Tally = usize > > ( & self , electorate : & str ) -> anyhow :: Result < ElectionData > { let mut data = self . read_raw_data ( electorate ) ? ; if electorate . ends_with ( " " ) { return Ok ( data ) ; } // don't have DOP file for mayoral elections. Besides, STV is not necessarily exactly a generalization of IRV... e.g. early termination conditions. // let mut tie_resolutions = TieResolutionsMadeByEC::default(); let official_transcript = self . read_official_dop_transcript ( & data . metadata ) ? ; loop { let transcript = distribute_preferences :: < Rules > ( & data , data . metadata . vacancies . unwrap ( ) , & data . metadata . excluded . iter ( ) . cloned ( ) . collect ( ) , & data . metadata . tie_resolutions , false ) ; if let Some ( ( favoured_candidate , unfavoured_candidate ) ) = official_transcript . compare_with_transcript_checking_for_ec_decisions ( & transcript , decode , false ) { println ! ( " " favoured_candidate unfavoured_candidate ) ; assert ! ( favoured_candidate 0 unfavoured_candidate 0 " " ) ; if data . metadata . tie_resolutions . tie_resolutions . contains ( & vec ! [ unfavoured_candidate favoured_candidate ] ) { panic ! ( " " ) } data . metadata . tie_resolutions . tie_resolutions . push ( vec ! [ unfavoured_candidate favoured_candidate ] ) ; } else { return Ok ( data ) ; } } }
Like read_raw_data, except also try to deduce the tie breaking decisions that were used by NSWEC.
Like read_raw_data except also try to deduce the tie breaking decisions that were used by NSWEC .
&self
electorate
&str
&self
electorate
&str