diff --git a/core/src/main/kotlin/org/cryptobiotic/rlauxe/core/RiskTestingFn.kt b/core/src/main/kotlin/org/cryptobiotic/rlauxe/core/RiskTestingFn.kt index 2ff6376..069a53f 100644 --- a/core/src/main/kotlin/org/cryptobiotic/rlauxe/core/RiskTestingFn.kt +++ b/core/src/main/kotlin/org/cryptobiotic/rlauxe/core/RiskTestingFn.kt @@ -1,20 +1,21 @@ package org.cryptobiotic.rlauxe.core -enum class TestH0Status(val complete: Boolean, val success: Boolean) { - InProgress(false, false), +// NOTE: leave them in this order, as contest status is min rank +enum class TestH0Status(val rank: Int, val complete: Boolean, val success: Boolean) { + InProgress(0,false, false), + + // contest status + ContestMisformed(1,true, false), // Contest incorrectly formed + MinMargin(2,true, false), // margin too small for RLA to efficiently work + TooManyPhantoms(3,true, false), // too many phantoms, makes margin < 0 + FailMaxSamplesAllowed(4,true, false), // estimated samples greater than maximum samples allowed // possible returns from RiskTestingFn - StatRejectNull(true, true), // statistical rejection of H0 - LimitReached(false, false), // cant tell from the number of samples available + StatRejectNull(10,true, true), // statistical rejection of H0 + LimitReached(11,false, false), // cant tell from the number of samples available //// only when sampling without replacement all the way close to Nc - SampleSumRejectNull(true, false), // SampleSum > Nc / 2, so we know H0 is false - AcceptNull(true, false), // SampleSum + (all remaining ballots == 1) < Nc / 2, so we know that H0 is true. - - // contest status - ContestMisformed(true, false), // Contest incorrectly formed - MinMargin(true, false), // margin too small for RLA to efficiently work - TooManyPhantoms(true, false), // too many phantoms, makes margin < 0 - FailMaxSamplesAllowed(true, false), // estimated samples greater than maximum samples allowed + SampleSumRejectNull(12,true, false), // SampleSum > Nc / 2, so we know H0 is false + AcceptNull(13,true, false), // SampleSum + (all remaining ballots == 1) < Nc / 2, so we know that H0 is true. } data class TestH0Result( diff --git a/core/src/main/kotlin/org/cryptobiotic/rlauxe/estimate/EstimateSampleSize.kt b/core/src/main/kotlin/org/cryptobiotic/rlauxe/estimate/EstimateSampleSize.kt index a01ee57..afa1330 100644 --- a/core/src/main/kotlin/org/cryptobiotic/rlauxe/estimate/EstimateSampleSize.kt +++ b/core/src/main/kotlin/org/cryptobiotic/rlauxe/estimate/EstimateSampleSize.kt @@ -136,7 +136,7 @@ class SimulateSampleSizeTask( override fun name() = "task ${contestUA.name} ${assertion.assorter.desc()}}" override fun run(): EstimationResult { val result: RunTestRepeatedResult = when (auditConfig.auditType) { - AuditType.CARD_COMPARISON -> + AuditType.CLCA -> simulateSampleSizeClcaAssorter( auditConfig, contestUA.contest, diff --git a/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/AuditConfig.kt b/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/AuditConfig.kt index 16ec6a5..2fe43ab 100644 --- a/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/AuditConfig.kt +++ b/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/AuditConfig.kt @@ -3,7 +3,7 @@ package org.cryptobiotic.rlauxe.workflow import org.cryptobiotic.rlauxe.core.ClcaErrorRates import org.cryptobiotic.rlauxe.util.secureRandom -enum class AuditType { POLLING, CARD_COMPARISON, ONEAUDIT } +enum class AuditType { POLLING, CLCA, ONEAUDIT } data class AuditConfig( val auditType: AuditType, @@ -28,7 +28,7 @@ data class AuditConfig( appendLine(" nsimEst=$nsimEst, quantile=$quantile, samplePctCutoff=$samplePctCutoff, minMargin=$minMargin version=$version") when (auditType) { AuditType.POLLING -> appendLine(" $pollingConfig") - AuditType.CARD_COMPARISON -> appendLine(" $clcaConfig") + AuditType.CLCA -> appendLine(" $clcaConfig") AuditType.ONEAUDIT -> appendLine(" $oaConfig, ") } } diff --git a/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/ClcaWorkflow.kt b/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/ClcaWorkflow.kt index 79bd9b1..b2320cd 100644 --- a/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/ClcaWorkflow.kt +++ b/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/ClcaWorkflow.kt @@ -30,7 +30,7 @@ class ClcaWorkflow( val contestsUA: List val cvrsUA: List init { - require (auditConfig.auditType == AuditType.CARD_COMPARISON) + require (auditConfig.auditType == AuditType.CLCA) // 2. Pre-processing and consistency checks // a) Check that the winners according to the CVRs are the reported winners. @@ -78,7 +78,7 @@ class ClcaWorkflow( ///////////////////////////////////////////////////////////////////////////////// -// The auditors retrieved the indicated cards, manually read the votes from those cards, and input the MVRs +// TODO lot of common code between the audit types... fun runClcaAudit(auditConfig: AuditConfig, contestsUA: List, sampleIndices: List, @@ -104,25 +104,21 @@ fun runClcaAudit(auditConfig: AuditConfig, val cvrPairs: List> = mvrs.zip(sampledCvrs) cvrPairs.forEach { (mvr, cvr) -> require(mvr.id == cvr.id) } - // TODO could parallelize across assertions if (!quiet) println("runAudit round $roundIdx") var allDone = true contestsNotDone.forEach { contestUA -> - var allAssertionsDone = true + var contestAssertionStatus = mutableListOf() contestUA.clcaAssertions.forEach { cassertion -> if (!cassertion.status.complete) { val testH0Result = auditClcaAssertion(auditConfig, contestUA, cassertion, cvrPairs, roundIdx, quiet=quiet) cassertion.status = testH0Result.status cassertion.round = roundIdx - allAssertionsDone = allAssertionsDone && cassertion.status.complete } + contestAssertionStatus.add(cassertion.status) } - if (allAssertionsDone) { - contestUA.done = true - contestUA.status = TestH0Status.StatRejectNull // TODO ??? - } + contestUA.done = contestAssertionStatus.all { it.complete } + contestUA.status = contestAssertionStatus.minBy { it.rank } // use lowest rank status. allDone = allDone && contestUA.done - } return allDone } diff --git a/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/OneAuditWorkflow.kt b/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/OneAuditWorkflow.kt index 88ae080..39e1636 100644 --- a/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/OneAuditWorkflow.kt +++ b/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/OneAuditWorkflow.kt @@ -46,36 +46,8 @@ class OneAuditWorkflow( return sample(this, roundIdx, quiet) } - // The auditors retrieve the indicated cards, manually read the votes from those cards, and input the MVRs override fun runAudit(sampleIndices: List, mvrs: List, roundIdx: Int): Boolean { - val contestsNotDone = contestsUA.filter{ !it.done } - val sampledCvrs = sampleIndices.map { cvrs[it] } - - // prove that sampledCvrs correspond to mvrs - require(sampledCvrs.size == mvrs.size) - val cvrPairs: List> = mvrs.zip(sampledCvrs) - cvrPairs.forEach { (mvr, cvr) -> require(mvr.id == cvr.id) } - - if (!quiet) println("runAudit round $roundIdx") - var allDone = true - contestsNotDone.forEach { contestUA -> - var allAssertionsDone = true - contestUA.clcaAssertions.forEach { assertion -> - if (!assertion.status.complete) { - val testH0Result = runOneAuditAssertionAlpha(auditConfig, contestUA, assertion, cvrPairs, roundIdx, quiet=quiet) - assertion.status = testH0Result.status - assertion.round = roundIdx - allAssertionsDone = allAssertionsDone && assertion.status.complete - } - } - if (allAssertionsDone) { - contestUA.done = true - contestUA.status = TestH0Status.StatRejectNull // TODO - } - allDone = allDone && contestUA.done - - } - return allDone + return runOneAudit(auditConfig, contestsUA, sampleIndices, mvrs, cvrs, roundIdx, quiet) } override fun auditConfig() = this.auditConfig @@ -83,6 +55,40 @@ class OneAuditWorkflow( override fun getBallotsOrCvrs() : List = cvrsUA } +fun runOneAudit(auditConfig: AuditConfig, + contestsUA: List, + sampleIndices: List, + mvrs: List, + cvrs: List, + roundIdx: Int, + quiet: Boolean): Boolean { + val contestsNotDone = contestsUA.filter{ !it.done } + val sampledCvrs = sampleIndices.map { cvrs[it] } + + // prove that sampledCvrs correspond to mvrs + require(sampledCvrs.size == mvrs.size) + val cvrPairs: List> = mvrs.zip(sampledCvrs) + cvrPairs.forEach { (mvr, cvr) -> require(mvr.id == cvr.id) } + + if (!quiet) println("runAudit round $roundIdx") + var allDone = true + contestsNotDone.forEach { contestUA -> + var contestAssertionStatus = mutableListOf() + contestUA.clcaAssertions.forEach { cassertion -> + if (!cassertion.status.complete) { + val testH0Result = runOneAuditAssertionAlpha(auditConfig, contestUA, cassertion, cvrPairs, roundIdx, quiet=quiet) + cassertion.status = testH0Result.status + cassertion.round = roundIdx + } + contestAssertionStatus.add(cassertion.status) + } + contestUA.done = contestAssertionStatus.all { it.complete } + contestUA.status = contestAssertionStatus.minBy { it.rank } // use lowest rank status. + allDone = allDone && contestUA.done + } + return allDone +} + fun runOneAuditAssertionAlpha( auditConfig: AuditConfig, contestUA: ContestUnderAudit, diff --git a/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/PersistentWorkflow.kt b/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/PersistentWorkflow.kt index c5abcdf..11f2b11 100644 --- a/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/PersistentWorkflow.kt +++ b/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/PersistentWorkflow.kt @@ -6,7 +6,7 @@ import org.cryptobiotic.rlauxe.core.CvrUnderAudit import org.cryptobiotic.rlauxe.estimate.* import kotlin.math.max -/** created from persistent state */ +/** Created from persistent state. See rla/src/main/kotlin/org/cryptobiotic/rlauxe/cli/RunRlaStartTest.kt */ class PersistentWorkflow( val auditConfig: AuditConfig, val contestsUA: List, @@ -32,10 +32,10 @@ class PersistentWorkflow( } override fun runAudit(sampleIndices: List, mvrs: List, roundIdx: Int): Boolean { - return if (auditConfig.auditType == AuditType.POLLING) { - runPollingAudit(auditConfig, contestsUA, mvrs, roundIdx, quiet) - } else { - runClcaAudit(auditConfig, contestsUA, sampleIndices, mvrs, cvrs, roundIdx, quiet) + return when (auditConfig.auditType) { + AuditType.CLCA -> runClcaAudit(auditConfig, contestsUA, sampleIndices, mvrs, cvrs, roundIdx, quiet) + AuditType.POLLING -> runPollingAudit(auditConfig, contestsUA, mvrs, roundIdx, quiet) + AuditType.ONEAUDIT -> runOneAudit(auditConfig, contestsUA, sampleIndices, mvrs, cvrs, roundIdx, quiet) } } diff --git a/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/PollingWorkflow.kt b/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/PollingWorkflow.kt index e4a3eaa..d24e11c 100644 --- a/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/PollingWorkflow.kt +++ b/core/src/main/kotlin/org/cryptobiotic/rlauxe/workflow/PollingWorkflow.kt @@ -71,21 +71,20 @@ fun runPollingAudit( return true } + if (!quiet) println("runAudit round $roundIdx") var allDone = true contestsNotDone.forEach { contestUA -> - var allAssertionsDone = true + var contestAssertionStatus = mutableListOf() contestUA.pollingAssertions.forEach { assertion -> if (!assertion.status.complete) { - val testResult = auditPollingAssertion(auditConfig, contestUA.contest as Contest, assertion, mvrs, roundIdx, quiet) - assertion.status = testResult.status + val testH0Result = auditPollingAssertion(auditConfig, contestUA.contest as Contest, assertion, mvrs, roundIdx, quiet) + assertion.status = testH0Result.status assertion.round = roundIdx - allAssertionsDone = allAssertionsDone && assertion.status.complete } + contestAssertionStatus.add(assertion.status) } - if (allAssertionsDone) { - contestUA.done = true - contestUA.status = TestH0Status.StatRejectNull // TODO - } + contestUA.done = contestAssertionStatus.all { it.complete } + contestUA.status = contestAssertionStatus.minBy { it.rank } // use lowest rank status. allDone = allDone && contestUA.done } return allDone diff --git a/core/src/test/kotlin/org/cryptobiotic/rlauxe/util/MeasureEstimationTaskConcurrency.kt b/core/src/test/kotlin/org/cryptobiotic/rlauxe/util/MeasureEstimationTaskConcurrency.kt index 95aa9e0..d6a43f7 100644 --- a/core/src/test/kotlin/org/cryptobiotic/rlauxe/util/MeasureEstimationTaskConcurrency.kt +++ b/core/src/test/kotlin/org/cryptobiotic/rlauxe/util/MeasureEstimationTaskConcurrency.kt @@ -31,7 +31,7 @@ class MeasureEstimationTaskConcurrency { val nassertions = contestsUA.sumOf { it.assertions().size } println("ncontests=${contestsUA.size} nassertions=${nassertions} ncvrs=${cvrs.size}") - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles = true, nsimEst = 10) + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles = true, nsimEst = 10) val tasks = mutableListOf>() contestsUA.filter { !it.done }.forEach { contestUA -> diff --git a/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestClcaWorkflow.kt b/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestClcaWorkflow.kt index a2acaf4..51bea18 100644 --- a/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestClcaWorkflow.kt +++ b/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestClcaWorkflow.kt @@ -6,7 +6,7 @@ import org.cryptobiotic.rlauxe.estimate.makeFuzzedCvrsFrom import kotlin.test.Test class TestClcaWorkflow { - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles=true, nsimEst=10) + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles=true, nsimEst=10) @Test fun testComparisonOneContest() { diff --git a/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestClcaWorkflowNoStyles.kt b/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestClcaWorkflowNoStyles.kt index 2d48886..706e132 100644 --- a/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestClcaWorkflowNoStyles.kt +++ b/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestClcaWorkflowNoStyles.kt @@ -19,7 +19,7 @@ class TestClcaWorkflowNoStyles { val testData = MultiContestTestData(ncontests, nbs, N, marginRange =marginRange, underVotePctRange =underVotePct, phantomPctRange =phantomRange) val errorRates = ClcaErrorRates(0.0, phantomPct, 0.0, 0.0, ) - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles=false, seed=12356667890L, nsimEst=10, + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles=false, seed=12356667890L, nsimEst=10, clcaConfig = ClcaConfig(ClcaStrategyType.apriori, errorRates=errorRates)) testComparisonWorkflow(auditConfig, testData) @@ -37,7 +37,7 @@ class TestClcaWorkflowNoStyles { val testData = MultiContestTestData(ncontests, nbs, N, marginRange =marginRange, underVotePctRange =underVotePct, phantomPctRange =phantomRange) val errorRates = ClcaErrorRates(0.0, phantomPct, 0.0, 0.0, ) - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles=false, seed=12356667890L, nsimEst=10, + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles=false, seed=12356667890L, nsimEst=10, clcaConfig = ClcaConfig(ClcaStrategyType.apriori, errorRates=errorRates)) testComparisonWorkflow(auditConfig, testData) @@ -52,7 +52,7 @@ class TestClcaWorkflowNoStyles { @Test fun noErrorsNoPhantoms() { - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles=false, nsimEst=10) + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles=false, nsimEst=10) val N = 100000 val ncontests = 11 val nbs = 4 @@ -65,7 +65,7 @@ class TestClcaWorkflowNoStyles { @Test fun noErrorsWithPhantoms() { - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles=false, nsimEst=10) + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles=false, nsimEst=10) val N = 100000 val ncontests = 42 val nbs = 11 @@ -88,14 +88,14 @@ class TestClcaWorkflowNoStyles { val testData = MultiContestTestData(ncontests, nbs, N, marginRange =marginRange, underVotePctRange =underVotePct, phantomPctRange =phantomRange) val errorRates = ClcaErrorRates(0.0, phantomPct, 0.0, 0.0, ) - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles=true, nsimEst=10, + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles=true, nsimEst=10, clcaConfig = ClcaConfig(ClcaStrategyType.apriori, errorRates=errorRates)) testComparisonWorkflow(auditConfig, testData) } @Test fun testComparisonWithFuzz() { - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles=true, nsimEst=10, + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles=true, nsimEst=10, clcaConfig = ClcaConfig(ClcaStrategyType.fuzzPct, simFuzzPct = 0.01)) val N = 50000 diff --git a/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestOneRoundClcaWorkflow.kt b/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestOneRoundClcaWorkflow.kt index 5b19da8..c85290b 100644 --- a/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestOneRoundClcaWorkflow.kt +++ b/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestOneRoundClcaWorkflow.kt @@ -6,7 +6,7 @@ import org.cryptobiotic.rlauxe.estimate.makeFuzzedCvrsFrom import kotlin.test.Test class TestOneRoundClcaWorkflow { - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles=true, nsimEst=10) + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles=true, nsimEst=10) @Test fun testOneContest() { diff --git a/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestRaireWorkflow.kt b/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestRaireWorkflow.kt index a9e4984..db30a04 100644 --- a/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestRaireWorkflow.kt +++ b/core/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestRaireWorkflow.kt @@ -9,12 +9,12 @@ class TestRaireWorkflow { @Test fun testRaireComparisonWithStyle() { - testRaireWorkflow(AuditConfig(AuditType.CARD_COMPARISON, hasStyles=true, nsimEst=10)) + testRaireWorkflow(AuditConfig(AuditType.CLCA, hasStyles=true, nsimEst=10)) } @Test fun testRaireComparisonNoStyle() { - testRaireWorkflow(AuditConfig(AuditType.CARD_COMPARISON, hasStyles=false, nsimEst=10)) + testRaireWorkflow(AuditConfig(AuditType.CLCA, hasStyles=false, nsimEst=10)) } fun testRaireWorkflow(auditConfig: AuditConfig) { @@ -26,7 +26,7 @@ class TestRaireWorkflow { @Test fun testRaireFuzz() { val mvrFuzzPct = .02 - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles=false, nsimEst=10, + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles=false, nsimEst=10, clcaConfig = ClcaConfig(ClcaStrategyType.fuzzPct, simFuzzPct = mvrFuzzPct)) val (rcontest: RaireContestUnderAudit, cvrs: List) = makeRaireContest(N=20000, minMargin=.04, quiet = true) diff --git a/core/src/testFixtures/kotlin/org/cryptobiotic/rlauxe/workflow/AuditTasks.kt b/core/src/testFixtures/kotlin/org/cryptobiotic/rlauxe/workflow/AuditTasks.kt index f94a9ef..0b5b4fd 100644 --- a/core/src/testFixtures/kotlin/org/cryptobiotic/rlauxe/workflow/AuditTasks.kt +++ b/core/src/testFixtures/kotlin/org/cryptobiotic/rlauxe/workflow/AuditTasks.kt @@ -27,7 +27,7 @@ class ClcaOneRoundAuditTaskGenerator( override fun generateNewTask(): OneRoundAuditTask { val useConfig = auditConfig ?: - AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst, samplePctCutoff=1.0, + AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst, samplePctCutoff=1.0, clcaConfig = clcaConfigIn ?: ClcaConfig(ClcaStrategyType.noerror)) val sim = ContestSimulation.make2wayTestContest(Nc=Nc, margin, undervotePct=underVotePct, phantomPct=phantomPct) diff --git a/core/src/testFixtures/kotlin/org/cryptobiotic/rlauxe/workflow/WorkflowTasks.kt b/core/src/testFixtures/kotlin/org/cryptobiotic/rlauxe/workflow/WorkflowTasks.kt index 0fcc1a8..a9a2243 100644 --- a/core/src/testFixtures/kotlin/org/cryptobiotic/rlauxe/workflow/WorkflowTasks.kt +++ b/core/src/testFixtures/kotlin/org/cryptobiotic/rlauxe/workflow/WorkflowTasks.kt @@ -91,7 +91,7 @@ class ClcaWorkflowTaskGenerator( override fun generateNewTask(): WorkflowTask { val useConfig = auditConfig ?: - AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst, samplePctCutoff=1.0, + AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst, samplePctCutoff=1.0, clcaConfig = clcaConfigIn ?: ClcaConfig(ClcaStrategyType.noerror)) val sim = ContestSimulation.make2wayTestContest(Nc=Nc, margin, undervotePct=underVotePct, phantomPct=phantomPct) @@ -209,7 +209,7 @@ class RaireWorkflowTaskGenerator( override fun generateNewTask(): WorkflowTask { val useConfig = auditConfig ?: - AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst, samplePctCutoff=1.0, + AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst, samplePctCutoff=1.0, clcaConfig = clcaConfigIn ?: ClcaConfig(ClcaStrategyType.noerror)) val (rcontest, testCvrs) = makeRaireContest(N=Nc, minMargin=margin, undervotePct=underVotePct, phantomPct=phantomPct, quiet = true) diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/clca/GenerateClcaErrorTable.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/clca/GenerateClcaErrorTable.kt index 307b843..316e4d2 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/clca/GenerateClcaErrorTable.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/clca/GenerateClcaErrorTable.kt @@ -22,7 +22,7 @@ class GenerateClcaErrorTable { @Test fun generateErrorTable() { - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles = true, seed = 12356667890L, nsimEst = 1000) + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles = true, seed = 12356667890L, nsimEst = 1000) val N = 100000 // TODO how much do the rates depend on the margin? diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/corla/CorlaWorkflow.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/corla/CorlaWorkflow.kt index 59c53c3..5a4c097 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/corla/CorlaWorkflow.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/corla/CorlaWorkflow.kt @@ -23,7 +23,7 @@ class CorlaWorkflowTaskGenerator( override fun generateNewTask(): WorkflowTask { val auditConfig = auditConfigIn ?: AuditConfig( - AuditType.CARD_COMPARISON, true, nsimEst = 10, + AuditType.CLCA, true, nsimEst = 10, clcaConfig = clcaConfigIn ?: ClcaConfig(ClcaStrategyType.fuzzPct, mvrsFuzzPct) ) @@ -54,7 +54,7 @@ class CorlaWorkflow( val cvrsUA: List init { - require (auditConfig.auditType == AuditType.CARD_COMPARISON) + require (auditConfig.auditType == AuditType.CLCA) // 2. Pre-processing and consistency checks // a) Check that the winners according to the CVRs are the reported winners. diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/EstimationVersion2.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/EstimationVersion2.kt index 9681175..acc737c 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/EstimationVersion2.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/EstimationVersion2.kt @@ -22,7 +22,7 @@ class EstimationVersion2 { val simFuzzPct = .02 val auditConfig = AuditConfig( - AuditType.CARD_COMPARISON, + AuditType.CLCA, true, quantile = .50, nsimEst = 100, diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/ExtraVsMarginByFuzzDiff.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/ExtraVsMarginByFuzzDiff.kt index b85b2ce..4485b5f 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/ExtraVsMarginByFuzzDiff.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/ExtraVsMarginByFuzzDiff.kt @@ -26,7 +26,7 @@ class ExtraVsMarginByFuzzDiff { val tasks = mutableListOf>>() fuzzDiffs.forEach { fuzzDiff -> val simFuzzPct = fuzzMvrs+fuzzDiff - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst, samplePctCutoff=1.0, minMargin = 0.0, + val auditConfig = AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst, samplePctCutoff=1.0, minMargin = 0.0, clcaConfig = ClcaConfig(ClcaStrategyType.fuzzPct, simFuzzPct)) margins.forEach { margin -> @@ -105,7 +105,7 @@ class ExtraVsMarginByFuzzDiff { repeat(10) { val clcaConfig = ClcaConfig(ClcaStrategyType.fuzzPct, fuzzPct) val auditConfig = AuditConfig( - AuditType.CARD_COMPARISON, + AuditType.CLCA, true, quantile = .50, nsimEst = 100, diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/PlotDistributions.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/PlotDistributions.kt index 58ac88c..e6cb9e5 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/PlotDistributions.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/estimate/PlotDistributions.kt @@ -23,7 +23,7 @@ class PlotDistributions { @Test fun plotDistributions() { val auditConfig = AuditConfig( - AuditType.CARD_COMPARISON, + AuditType.CLCA, true, samplePctCutoff = 1.0, nsimEst = nsimEst, diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/fuzz/PlotClcaFuzz.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/fuzz/PlotClcaFuzz.kt index 10920a5..c4e4f43 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/fuzz/PlotClcaFuzz.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/fuzz/PlotClcaFuzz.kt @@ -22,7 +22,7 @@ class PlotClcaFuzz { val margins = listOf(.001, .002, .003, .004, .005, .006, .008, .01, .012, .016, .02, .03, .04, .05, .06, .07, .08, .10) // do all margins and sample sizes - val config = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = 100, minMargin = 0.0, samplePctCutoff = 1.0) + val config = AuditConfig(AuditType.CLCA, true, nsimEst = 100, minMargin = 0.0, samplePctCutoff = 1.0) val stopwatch = Stopwatch() val tasks = mutableListOf() diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenAttackByStrategy.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenAttackByStrategy.kt index 5b851cb..ab1a0af 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenAttackByStrategy.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenAttackByStrategy.kt @@ -22,7 +22,7 @@ class GenAttackByStrategy { val margins = allMargins.filter { it > phantomPct } val stopwatch = Stopwatch() - val config = AuditConfig(AuditType.CARD_COMPARISON, true) + val config = AuditConfig(AuditType.CLCA, true) val tasks = mutableListOf() margins.forEach { margin -> @@ -116,7 +116,7 @@ class GenAttackByStrategy { @Test fun runOne() { - val config = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst) + val config = AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst) val reportedMargin = .01 val flip1 = .01 val taskgen = ClcaOneRoundAuditTaskGenerator( diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenVsMarginByStrategy.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenVsMarginByStrategy.kt index a96d325..8674acc 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenVsMarginByStrategy.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenVsMarginByStrategy.kt @@ -22,7 +22,7 @@ class GenVsMarginByStrategy { val margins = allMargins.filter { it > phantomPct } val stopwatch = Stopwatch() - val config = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst) + val config = AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst) val tasks = mutableListOf() margins.forEach { margin -> diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenVsMarginOracle.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenVsMarginOracle.kt index bb489ab..322a486 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenVsMarginOracle.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/oneround/GenVsMarginOracle.kt @@ -1,9 +1,6 @@ package org.cryptobiotic.rlauxe.oneround import org.cryptobiotic.rlauxe.concur.RepeatedWorkflowRunner -import org.cryptobiotic.rlauxe.core.ClcaAssertion -import org.cryptobiotic.rlauxe.core.ClcaAssorter -import org.cryptobiotic.rlauxe.core.Cvr import org.cryptobiotic.rlauxe.rlaplots.* import org.cryptobiotic.rlauxe.util.Stopwatch import org.cryptobiotic.rlauxe.workflow.* @@ -24,7 +21,7 @@ class GenVsMarginOracle { val stopwatch = Stopwatch() - val config = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst) + val config = AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst) val tasks = mutableListOf() margins.forEach { margin -> @@ -88,7 +85,7 @@ class GenVsMarginOracle { @Test fun runOne() { - val config = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst) + val config = AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst) val reportedMargin = .01 val flip2 = .01 val taskgen = ClcaOneRoundAuditTaskGenerator( diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/raire/GenRaireNoErrorsPlots.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/raire/GenRaireNoErrorsPlots.kt index 16fc04f..627a26c 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/raire/GenRaireNoErrorsPlots.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/raire/GenRaireNoErrorsPlots.kt @@ -21,7 +21,7 @@ class GenRaireNoErrorsPlots { val margins = listOf(.005, .006, .008, .01, .012, .016, .02, .03, .04, .05) - val config = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst, minMargin = 0.0, samplePctCutoff = 1.0) + val config = AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst, minMargin = 0.0, samplePctCutoff = 1.0) val stopwatch = Stopwatch() val tasks = mutableListOf>>() diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsFuzzByStrategy.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsFuzzByStrategy.kt index e975c9b..5d65a76 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsFuzzByStrategy.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsFuzzByStrategy.kt @@ -23,7 +23,7 @@ class GenVsFuzzByStrategy { val tasks = mutableListOf() - val config = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = 100, minMargin = 0.0, samplePctCutoff = 1.0) + val config = AuditConfig(AuditType.CLCA, true, nsimEst = 100, minMargin = 0.0, samplePctCutoff = 1.0) fuzzPcts.forEach { fuzzPct -> val clcaGenerator1 = ClcaWorkflowTaskGenerator(N, margin, 0.0, 0.0, fuzzPct, diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsMarginByStrategy.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsMarginByStrategy.kt index 1485fab..5acd920 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsMarginByStrategy.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsMarginByStrategy.kt @@ -22,7 +22,7 @@ class GenVsMarginByStrategy { val tasks = mutableListOf() - val config = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = 100, minMargin = 0.0, samplePctCutoff = 1.0) + val config = AuditConfig(AuditType.CLCA, true, nsimEst = 100, minMargin = 0.0, samplePctCutoff = 1.0) margins.forEach { margin -> val clcaGenerator1 = ClcaWorkflowTaskGenerator(N, margin, 0.0, 0.0, fuzzPct, diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsMarginByStrategy2.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsMarginByStrategy2.kt index ee83532..a05d611 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsMarginByStrategy2.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/strategy/GenVsMarginByStrategy2.kt @@ -21,7 +21,7 @@ class GenVsMarginByStrategy2 { val margins = allMargins.filter { it > phantomPct } val stopwatch = Stopwatch() - val config = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = 100, minMargin = 0.0, samplePctCutoff = 1.0) + val config = AuditConfig(AuditType.CLCA, true, nsimEst = 100, minMargin = 0.0, samplePctCutoff = 1.0) val tasks = mutableListOf() margins.forEach { margin -> diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/unittest/TestClcaEstimationFailure.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/unittest/TestClcaEstimationFailure.kt index a286c02..8ad851b 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/unittest/TestClcaEstimationFailure.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/unittest/TestClcaEstimationFailure.kt @@ -24,7 +24,7 @@ class TestClcaEstimationFailure { val cvrs = test.makeCvrsFromContests() val auditConfig = AuditConfig( - AuditType.CARD_COMPARISON, + AuditType.CLCA, hasStyles = true, quantile = .50, // TODO review samplePctCutoff = .10, diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/unittest/TestClcaFuzzSampler.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/unittest/TestClcaFuzzSampler.kt index f4ac9aa..9ff30da 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/unittest/TestClcaFuzzSampler.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/unittest/TestClcaFuzzSampler.kt @@ -24,7 +24,7 @@ class TestClcaFuzzSampler { println("total ncvrs = ${cvrs.size}\n") val auditConfig = AuditConfig( - AuditType.CARD_COMPARISON, + AuditType.CLCA, hasStyles = true, clcaConfig = ClcaConfig(strategy = ClcaStrategyType.previous, simFuzzPct = .011) ) diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditVariance.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditVariance.kt index 9a250cf..4dc70cc 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditVariance.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditVariance.kt @@ -56,7 +56,7 @@ class CompareAuditVariance { val margins = listOf(.006, .008, .01, .012, .016, .02, .03, .04, .05, .06, .07, .08, .10) - val clcaConfig = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst, samplePctCutoff = 1.0, minMargin = 0.0, + val clcaConfig = AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst, samplePctCutoff = 1.0, minMargin = 0.0, clcaConfig =ClcaConfig(ClcaStrategyType.fuzzPct, fuzzPct)) val stopwatch = Stopwatch() diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsByStyles.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsByStyles.kt index d1ba16b..a2b3bbb 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsByStyles.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsByStyles.kt @@ -40,7 +40,7 @@ class CompareAuditsByStyles { Nb=Nc) tasks.add(RepeatedWorkflowRunner(nruns, pollingGenerator)) - val clcaConfigNS = AuditConfig(AuditType.CARD_COMPARISON, false, samplePctCutoff=1.0, nsimEst = nsimEst, + val clcaConfigNS = AuditConfig(AuditType.CLCA, false, samplePctCutoff=1.0, nsimEst = nsimEst, clcaConfig = ClcaConfig(ClcaStrategyType.noerror)) val clcaGeneratorNS = ClcaWorkflowTaskGenerator(Nc, margin, 0.0, 0.0, 0.0, mapOf("nruns" to nruns.toDouble(), "cat" to "clcaNoStyles"), @@ -49,7 +49,7 @@ class CompareAuditsByStyles { ) tasks.add(RepeatedWorkflowRunner(nruns, clcaGeneratorNS)) - val clcaConfig = AuditConfig(AuditType.CARD_COMPARISON, true, samplePctCutoff=1.0, nsimEst = nsimEst, + val clcaConfig = AuditConfig(AuditType.CLCA, true, samplePctCutoff=1.0, nsimEst = nsimEst, clcaConfig = ClcaConfig(ClcaStrategyType.noerror)) val clcaGenerator = ClcaWorkflowTaskGenerator(Nc, margin, 0.0, 0.0, 0.0, mapOf("nruns" to nruns.toDouble(), "cat" to "clcaWithStyles"), diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsWithPhantoms.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsWithPhantoms.kt index 4aaf289..834f502 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsWithPhantoms.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsWithPhantoms.kt @@ -29,7 +29,7 @@ class CompareAuditsWithPhantoms { tasks.add(RepeatedWorkflowRunner(nruns, pollingGenerator)) val clcaGenerator = ClcaWorkflowTaskGenerator(N, margin, 0.0, phantomPct=phantom, mvrFuzzPct, - auditConfig=AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst), + auditConfig=AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst), parameters=mapOf("nruns" to nruns, "phantom" to phantom, "mvrFuzz" to mvrFuzzPct, "cat" to "clca")) tasks.add(RepeatedWorkflowRunner(nruns, clcaGenerator)) @@ -86,7 +86,7 @@ class CompareAuditsWithPhantoms { val phantoms = listOf(.00, .005, .01, .02, .03, .035, .04, .0425) val stopwatch = Stopwatch() - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst, samplePctCutoff = 1.0, minMargin = 0.0, + val auditConfig = AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst, samplePctCutoff = 1.0, minMargin = 0.0, clcaConfig = ClcaConfig(ClcaStrategyType.noerror)) val tasks = mutableListOf>>() diff --git a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsWithUndervotes.kt b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsWithUndervotes.kt index 4c288d1..c7994d8 100644 --- a/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsWithUndervotes.kt +++ b/plots/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/CompareAuditsWithUndervotes.kt @@ -30,7 +30,7 @@ class CompareAuditsWithUndervotes { tasks.add(RepeatedWorkflowRunner(nruns, pollingGenerator)) val clcaGenerator = ClcaWorkflowTaskGenerator(N, margin, undervote, 0.0, mvrFuzzPct, - auditConfig=AuditConfig(AuditType.CARD_COMPARISON, true, nsimEst = nsimEst), + auditConfig=AuditConfig(AuditType.CLCA, true, nsimEst = nsimEst), parameters=mapOf("nruns" to nruns, "undervote" to undervote, "cat" to "clca")) tasks.add(RepeatedWorkflowRunner(nruns, clcaGenerator)) diff --git a/rla/src/main/kotlin/org/cryptobiotic/rlauxe/cli/RunRlaRound.kt b/rla/src/main/kotlin/org/cryptobiotic/rlauxe/cli/RunRlaRound.kt index c55abe6..7b42e28 100644 --- a/rla/src/main/kotlin/org/cryptobiotic/rlauxe/cli/RunRlaRound.kt +++ b/rla/src/main/kotlin/org/cryptobiotic/rlauxe/cli/RunRlaRound.kt @@ -98,7 +98,7 @@ fun readPersistentWorkflow(round: Int, publish: Publisher): Pair val cn = contestUA.Nc diff --git a/rla/src/test/kotlin/org/cryptobiotic/rlauxe/persist/json/TestAuditConfigJson.kt b/rla/src/test/kotlin/org/cryptobiotic/rlauxe/persist/json/TestAuditConfigJson.kt index 8cdbfa9..a62c886 100644 --- a/rla/src/test/kotlin/org/cryptobiotic/rlauxe/persist/json/TestAuditConfigJson.kt +++ b/rla/src/test/kotlin/org/cryptobiotic/rlauxe/persist/json/TestAuditConfigJson.kt @@ -15,11 +15,11 @@ class TestAuditConfigJson { @Test fun testRoundtrip() { - testRoundtrips(AuditConfig(AuditType.CARD_COMPARISON, hasStyles=true, seed = 12356667890L)) + testRoundtrips(AuditConfig(AuditType.CLCA, hasStyles=true, seed = 12356667890L)) testRoundtrips(AuditConfig(AuditType.POLLING, hasStyles=true, seed = 12356667890L)) testRoundtrips(AuditConfig(AuditType.ONEAUDIT, hasStyles=true, seed = 12356667890L)) - testRoundtrips(AuditConfig(AuditType.CARD_COMPARISON, hasStyles=true, seed = 12356667890L, riskLimit=.03, nsimEst=42, quantile=.50, + testRoundtrips(AuditConfig(AuditType.CLCA, hasStyles=true, seed = 12356667890L, riskLimit=.03, nsimEst=42, quantile=.50, samplePctCutoff=.10, version=2.0, clcaConfig= ClcaConfig(ClcaStrategyType.fuzzPct, simFuzzPct=.111, ClcaErrorRates(.01, .02, .03, .04), d = 99) )) @@ -47,7 +47,7 @@ class TestAuditConfigJson { } fun testRoundtripIO(target: AuditConfig) { - val target = AuditConfig(AuditType.CARD_COMPARISON, hasStyles=true, seed = 12356667890L) + val target = AuditConfig(AuditType.CLCA, hasStyles=true, seed = 12356667890L) writeAuditConfigJsonFile(target, filename) val result = readAuditConfigJsonFile(filename) assertTrue(result is Ok) diff --git a/rla/src/test/kotlin/org/cryptobiotic/rlauxe/persist/json/TestAuditStateJson.kt b/rla/src/test/kotlin/org/cryptobiotic/rlauxe/persist/json/TestAuditStateJson.kt index 40aaa6c..ad264ae 100644 --- a/rla/src/test/kotlin/org/cryptobiotic/rlauxe/persist/json/TestAuditStateJson.kt +++ b/rla/src/test/kotlin/org/cryptobiotic/rlauxe/persist/json/TestAuditStateJson.kt @@ -61,7 +61,7 @@ class TestAuditStateJson { fun testRoundtripWithRounds() { val fuzzMvrs = .01 val auditConfig = AuditConfig( - AuditType.CARD_COMPARISON, hasStyles = true, seed = 12356667890L, nsimEst = 10, + AuditType.CLCA, hasStyles = true, seed = 12356667890L, nsimEst = 10, ) val N = 5000 diff --git a/rla/src/test/kotlin/org/cryptobiotic/rlauxe/raire/AssertionRLAipynb.kt b/rla/src/test/kotlin/org/cryptobiotic/rlauxe/raire/AssertionRLAipynb.kt index c281e9f..f52e3bf 100644 --- a/rla/src/test/kotlin/org/cryptobiotic/rlauxe/raire/AssertionRLAipynb.kt +++ b/rla/src/test/kotlin/org/cryptobiotic/rlauxe/raire/AssertionRLAipynb.kt @@ -276,7 +276,7 @@ class AssertionRLA { candidate = listOf(15, 16, 17, 18, 45), winner = listOf(15), assertion_file = "./data/SFDA2019/SF2019Nov8Assertions.json", - audit_type = AuditType.CARD_COMPARISON, + audit_type = AuditType.CLCA, ) // Raire Assertions diff --git a/rla/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestPersistentWorkflowClca.kt b/rla/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestPersistentWorkflowClca.kt index f04e71c..939b352 100644 --- a/rla/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestPersistentWorkflowClca.kt +++ b/rla/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestPersistentWorkflowClca.kt @@ -23,7 +23,7 @@ class TestPersistentWorkflowClca { fun testPersistentWorkflowClca() { val fuzzMvrs = .01 val publish = Publisher(topdir) - val auditConfig = AuditConfig(AuditType.CARD_COMPARISON, hasStyles=true, seed = 12356667890L, nsimEst=10) + val auditConfig = AuditConfig(AuditType.CLCA, hasStyles=true, seed = 12356667890L, nsimEst=10) writeAuditConfigJsonFile(auditConfig, publish.auditConfigFile()) val N = 5000 @@ -104,7 +104,7 @@ fun readPersistentWorkflow(round: Int, publish: Publisher): PersistentWorkflow { val electionState = resultAuditResult.unwrap() assertNotNull(electionState) - if (auditConfig.auditType == AuditType.CARD_COMPARISON) { + if (auditConfig.auditType == AuditType.CLCA) { val resultCvrs = readCvrsJsonFile(publish.cvrsFile()) if (resultCvrs is Err) println(resultCvrs) assertTrue(resultCvrs is Ok) diff --git a/rla/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestRaireWorkflowFromJson.kt b/rla/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestRaireWorkflowFromJson.kt index 5cb907f..a09c152 100644 --- a/rla/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestRaireWorkflowFromJson.kt +++ b/rla/src/test/kotlin/org/cryptobiotic/rlauxe/workflow/TestRaireWorkflowFromJson.kt @@ -10,12 +10,12 @@ class TestRaireWorkflowFromJson { @Test fun testRaireComparisonWithStyle() { - testRaireWorkflow(AuditConfig(AuditType.CARD_COMPARISON, hasStyles=true, seed = 12356667890L, nsimEst=10)) + testRaireWorkflow(AuditConfig(AuditType.CLCA, hasStyles=true, seed = 12356667890L, nsimEst=10)) } @Test fun testRaireComparisonNoStyle() { - testRaireWorkflow(AuditConfig(AuditType.CARD_COMPARISON, hasStyles=false, seed = 123568667890L, nsimEst=10)) + testRaireWorkflow(AuditConfig(AuditType.CLCA, hasStyles=false, seed = 123568667890L, nsimEst=10)) } fun testRaireWorkflow(auditConfig: AuditConfig) {