division: 0.6:0.8
bits | prob | time | cooled-prob | time |
---|---|---|---|---|
4 | 0.07244126481043762 | 4.32 | 0.2997385332640076 | 25.42 |
5 | 0.03735406347868613 | 4.39 | 0.16215362712357842 | 29.31 |
6 | 0.019209135419509936 | 0.09981409220957191 | 37.98 | |
7 | 0.009850902273013015 | 0.045814085969079335 | 87.910992 | |
8 | 0.005037811474275325 | 0.02097595111357017 | 256.70 | |
9 | 0.002569341455742216 | 6.07 | 0.010066646959521903 | 1165 |
In [23]:
using QuDynamics
using AdiaComput
using QuSAT
using QuBase
using QuComputStates
In [31]:
function gap(aqc,t)
H = Hamiltonian(aqc,t)|>coeffs|>full
eigens = eigfact(H)[:values]|>real|>sort
gap = eigens[2]-eigens[1]
return gap
end
function findmin(n::Int;step=1e-2)
ins,ans = generate(n)
pH = QuArray(pHamiltonian(ins,n),(comput_basis(n),comput_basis(n)))
aqc = AQC(pH,n;maxtime=1)
t = 0
pre = gap(aqc,0)
eps = 100
while eps>1e-2
Δₜ = (gap(aqc,t)-gap(aqc,t+step))/step
# if abs(Δₜ)>0.5
# Δₜ = sign(Δₜ)*0.5
# end
# @show Δₜ
t+=0.01*Δₜ
# t = t - floor(t)
cur = gap(aqc,t)
# @show cur
eps = pre - cur
pre = cur
end
return t,gap(aqc,t)
end
Out[31]:
In [32]:
minimum_gap_distribution = Float64[]
minimum_gap = Float64[]
for i=4:9
min = findmin(i)
push!(minimum_gap_distribution,min[1])
push!(minimum_gap,min[2])
end
In [41]:
using PyPlot
figure(figsize=(8,5))
bits = 4:9
normal = [0.07244126481043762,0.03735406347868613,0.019209135419509936,0.009850902273013015,0.005037811474275325,0.002569341455742216]
cooled = [0.2997385332640076,0.16215362712357842,0.09981409220957191,0.045814085969079335,0.02097595111357017,0.010066646959521903]
optimized_ratio = (cooled-normal)./normal
plot(bits,optimized_ratio,"o-",label="optimized ratio")
xlabel("qubits")
ylabel("optimized ratio")
ylim(2.8,4.3)
twinx()
ylabel("success probility")
plot(bits,normal,"go--",label="normal procedure")
plot(bits,cooled,"co-.",label="optimized")
xlim(3.5,9.5)
ylim(0.0,0.36)
legend()
savefig("")
Out[41]:
In [30]:
function ploteigen(n)
ins,ans = generate(n)
pH = QuArray(pHamiltonian(ins,n),(comput_basis(n),comput_basis(n)))
aqc = AQC(pH,n;maxtime=1)
return [gap(aqc,t) for t = 0.0:1e-2:1]
end
plot(ploteigen(6))
Out[30]:
In [80]:
figure(figsize=(10,5))
ax = gca()
xlabel("qubits")
ylabel("gap (J)")
p1, = ax[:plot](bits,minimum_gap,label="minimum gap","go-")
xlim(3.5,9.5)
ax2 = twinx()
ylabel("optimized ratio")
p2, = ax2[:plot](bits,optimized_ratio,label="optimized ratio","co--")
ylim(2.8,4.3)
xlim(3.5,9.5)
legend((p1,p2),("minimum gap","optimized ratio"))
Out[80]:
In [86]:
figure(figsize=(10,5))
ax = gca()
xlabel("qubits")
ylabel("position")
p1, = ax[:plot](bits,abs(minimum_gap_distribution.-0.7),label="minimum gap position","go-")
xlim(3.5,9.5)
ax2 = twinx()
ylabel("optimized ratio")
p2, = ax2[:plot](bits,optimized_ratio,label="optimized ratio","co--")
ylim(2.8,4.3)
xlim(3.5,9.5)
legend((p1,p2),("relative position to 0.7","optimized ratio"))
Out[86]:
In [ ]: