File size: 1,334 Bytes
614d294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env julia

# CPU-only scope expansion for Claim 1 and protection run for Claim 5.
# The included qcorridor.jl is the pinned author implementation; this script
# changes only corridor length, horizon, and the independent seed grid.

if length(ARGS) != 2
    error("expected AUTHORS_QCORRIDOR_JL OUTPUT_CSV")
end

include(abspath(ARGS[1]))

const K_VALUES = (1, 2, 3, 5, 10, 20, 50, 100, 200, 400, 800)
const T_VALUES = (500, 1000, 2000)
const SEEDS = 0:199
const ALPHA0 = 0.1
const ALPHAT = 0.01
const EPS0 = 0.1
const EPST = 0.01

function endpoint_fraction(T::Int, k::Int, committed::Bool)
    count = 0
    for seed in SEEDS
        _, qs = qcorridor(T, k, committed, seed, ALPHA0, ALPHAT, EPS0, EPST, 0)
        q = qs[end, :, :]
        count += (q[2, 2] > q[2, 1] && q[1, 2] > q[1, 1])
    end
    return count, length(SEEDS)
end

open(abspath(ARGS[2]), "w") do io
    println(io, "mode,T,k,optimal_count,total_seeds,optimal_fraction")
    for T in T_VALUES, k in K_VALUES
        committed_count, total = endpoint_fraction(T, k, true)
        regular_count, _ = endpoint_fraction(T, k, false)
        println(io, "committed,", T, ",", k, ",", committed_count, ",", total, ",", committed_count / total)
        println(io, "regular,", T, ",", k, ",", regular_count, ",", total, ",", regular_count / total)
    end
end