adiabaticcircuitmaker
qemcmc.circuits.adiabaticcircuitmaker ¶
AdiabaticCircuitMaker ¶
Bases: BaseCircuitMaker
Constructs and simulates adiabatic quantum circuits for QeMCMC proposals.
The total time-dependent Hamiltonian simulated by the circuit is:
``H(t) = h(t) * mix_weight * H_mixer + H_problem``
where H_problem encodes the classical energy model and H_mixer
corresponds to a transverse-field term. The dimensionless schedule function
h(t) ramps linearly from 0 to 1 over ramp duration alpha, remains at 1
for plateau duration kappa, and ramps down from 1 to 0 over duration alpha
(total duration 2 * alpha + kappa).
The time-dependent evolution is approximated using second-order Trotterisation
via qml.ApproxTimeEvolution over r = max(1, round((2 * alpha + kappa) / dt)) steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
EnergyModel
|
Energy model defining the target Boltzmann distribution. |
required |
Source code in src/qemcmc/circuits/adiabaticcircuitmaker.py
get_sample ¶
Generate a single sample by evolving the system under a time-dependent Hamiltonian and measuring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s_cg
|
str
|
Input bitstring for the subgroup. |
required |
alpha
|
float
|
Duration of the adiabatic ramp. |
required |
kappa
|
float
|
Duration of the plateau. |
required |
mix_weight
|
float
|
Coefficient for the mixer Hamiltonian. |
required |
local_couplings
|
list
|
Coupling tensors for the subgroup. |
required |
weights
|
list of float
|
Coefficients for the problem Hamiltonian terms. Defaults to ones. |
None
|
dt
|
float
|
Timestep size for second order Trotter evolution. Defaults to 0.3. |
0.3
|
Returns:
| Type | Description |
|---|---|
str
|
A single bitstring sample. |
Source code in src/qemcmc/circuits/adiabaticcircuitmaker.py
linear_schedule ¶
Calculates the linear ramp factor h(t) with a plateau of duration kappa and ramp duration alpha.
The schedule satisfies h(t): 0 -> 1 -> 1 -> 0 as t: 0 -> alpha -> alpha + kappa -> 2 * alpha + kappa.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
Current time during the evolution. |
required |
alpha
|
float
|
Duration of the linear ramp. |
required |
kappa
|
float
|
Duration of the constant plateau. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The instantaneous mixer weight factor in [0, 1]. |
Source code in src/qemcmc/circuits/adiabaticcircuitmaker.py
get_state_vector ¶
Evolve the initial state under the adiabatic Hamiltonian and return the final state vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s_cg
|
str
|
Input bitstring for the subgroup. |
required |
alpha
|
float
|
Duration of the adiabatic ramp. |
required |
kappa
|
float
|
Duration of the plateau. |
required |
mix_weight
|
float
|
Coefficient for the mixer Hamiltonian. |
required |
weights
|
list of float
|
Coefficients for the problem Hamiltonian terms. Defaults to ones. |
None
|
dt
|
float
|
Timestep size for second order Trotter evolution. Defaults to 0.3. |
0.3
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The final quantum state vector. |
Source code in src/qemcmc/circuits/adiabaticcircuitmaker.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
update ¶
Update a bitstring by evolving a subgroup.
This performs a time evolution on a coarse-grained Hamiltonian to get s' from s.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
str
|
The initial bitstring. |
required |
subgroup_choice
|
list of int
|
Indices of the subgroup to evolve. |
required |
local_couplings
|
list
|
Coupling tensors for the subgroup. |
required |
gamma
|
float
|
Mixing parameter. |
required |
alpha
|
float
|
Adiabatic ramp time. |
required |
kappa
|
float
|
Plateau time. |
required |
dt
|
float
|
Trotter step size for the approximate time evolution. Defaults to 0.3. |
0.3
|
Returns:
| Type | Description |
|---|---|
str
|
The updated bitstring s'. |