@@ -6,6 +6,16 @@ Is returned by [`init(::ProjectorMonteCarloProblem)`](@ref) and solved with
6
6
7
7
Obtain the results of a simulation `sm` as a DataFrame with `DataFrame(sm)`.
8
8
9
+ ## Fields
10
+ - `problem::ProjectorMonteCarloProblem`: The problem that was solved
11
+ - `state::Rimu.ReplicaState`: The current state of the simulation
12
+ - `report::Rimu.Report`: The report of the simulation
13
+ - `modified::Bool`: Whether the simulation has been modified
14
+ - `aborted::Bool`: Whether the simulation has been aborted
15
+ - `success::Bool`: Whether the simulation has been completed successfully
16
+ - `message::String`: A message about the simulation status
17
+ - `elapsed_time::Float64`: The time elapsed during the simulation
18
+
9
19
See also [`state_vectors`](@ref),
10
20
[`ProjectorMonteCarloProblem`](@ref), [`init`](@ref), [`solve!`](@ref).
11
21
"""
@@ -80,7 +90,7 @@ function PMCSimulation(problem::ProjectorMonteCarloProblem; copy_vectors=true)
80
90
@unpack algorithm, hamiltonian, start_at, style, threading, simulation_plan,
81
91
replica_strategy, initial_shift_parameters,
82
92
reporting_strategy, post_step_strategy,
83
- maxlength , metadata, initiator, random_seed, spectral_strategy, minimum_size = problem
93
+ max_length , metadata, initiator, random_seed, spectral_strategy, minimum_size = problem
84
94
85
95
reporting_strategy = refine_reporting_strategy (reporting_strategy)
86
96
@@ -114,30 +124,33 @@ function PMCSimulation(problem::ProjectorMonteCarloProblem; copy_vectors=true)
114
124
# set up the spectral_states
115
125
wm = working_memory (vectors[1 , 1 ])
116
126
spectral_states = ntuple (n_replicas) do i
127
+ replica_id = if n_replicas == 1
128
+ " "
129
+ else
130
+ " _$(i) "
131
+ end
117
132
SpectralState (
118
133
ntuple (n_spectral) do j
119
134
v = vectors[i, j]
120
135
sp = shift_parameters[i, j]
121
- id = if n_replicas * n_spectral == 1
136
+ spectral_id = if n_spectral == 1
122
137
" "
123
- elseif n_spectral == 1
124
- " _$(i) "
125
138
else
126
- " _s$(j) _ $(i) " # j is the spectral state index, i is the replica index
127
- end # we have to think about how to label the spectral states
139
+ " _s$(j) " # j is the spectral state index, i is the replica index
140
+ end
128
141
SingleState (
129
142
hamiltonian, algorithm, v, zerovector (v),
130
143
wm isa PDWorkingMemory ? wm : working_memory (v), # reuse for PDVec
131
- sp, id
144
+ sp, replica_id * spectral_id
132
145
)
133
- end , spectral_strategy)
146
+ end , spectral_strategy, replica_id )
134
147
end
135
148
@assert spectral_states isa NTuple{n_replicas, <: SpectralState }
136
149
137
150
# set up the initial state
138
151
state = ReplicaState (
139
152
spectral_states,
140
- Ref (maxlength ),
153
+ Ref (max_length ),
141
154
Ref (simulation_plan. starting_step),
142
155
simulation_plan,
143
156
reporting_strategy,
242
255
243
256
Advance the simulation by one step.
244
257
245
- Calling [`solve!`](@ref) will advance the simulation until the last step or the walltime is
258
+ Calling [`solve!`](@ref) will advance the simulation until the last step or the wall time is
246
259
exceeded. When completing the simulation without calling [`solve!`](@ref), the simulation
247
260
report needs to be finalised by calling [`Rimu.finalize_report!`](@ref).
248
261
300
313
solve(::ProjectorMonteCarloProblem)::PMCSimulation
301
314
302
315
Initialize and solve a [`ProjectorMonteCarloProblem`](@ref) until the last step is completed
303
- or the walltime limit is reached.
316
+ or the wall time limit is reached.
304
317
305
318
See also [`init`](@ref), [`solve!`](@ref), [`step!`](@ref), [`Rimu.PMCSimulation`](@ref),
306
319
and [`solve(::ExactDiagonalizationProblem)`](@ref).
@@ -310,16 +323,17 @@ CommonSolve.solve
310
323
"""
311
324
solve!(sm::PMCSimulation; kwargs...)::PMCSimulation
312
325
313
- Solve a [`Rimu.PMCSimulation`](@ref) until the last step is completed or the walltime limit
326
+ Solve a [`Rimu.PMCSimulation`](@ref) until the last step is completed or the wall time limit
314
327
is reached.
315
328
316
- To continue a previously completed simulation, set a new `last_step` or `walltime ` using the
317
- keyword arguments. Optionally, changes can be made to the `replica_strategy`, the
329
+ To continue a previously completed simulation, set a new `last_step` or `wall_time ` using
330
+ the keyword arguments. Optionally, changes can be made to the `replica_strategy`, the
318
331
`post_step_strategy`, or the `reporting_strategy`.
319
332
320
333
# Optional keyword arguments:
321
334
* `last_step = nothing`: Set the last step to a new value and continue the simulation.
322
- * `walltime = nothing`: Set the allowed walltime to a new value and continue the simulation.
335
+ * `wall_time = nothing`: Set the allowed wall time to a new value and continue the
336
+ simulation.
323
337
* `reset_time = false`: Reset the `elapsed_time` counter and continue the simulation.
324
338
* `empty_report = false`: Empty the report before continuing the simulation.
325
339
* `replica_strategy = nothing`: Change the replica strategy. Requires the number of replicas
@@ -335,7 +349,7 @@ See also [`ProjectorMonteCarloProblem`](@ref), [`init`](@ref), [`solve`](@ref),
335
349
"""
336
350
function CommonSolve. solve! (sm:: PMCSimulation ;
337
351
last_step = nothing ,
338
- walltime = nothing ,
352
+ wall_time = nothing ,
339
353
reset_time = false ,
340
354
replica_strategy= nothing ,
341
355
post_step_strategy= nothing ,
@@ -351,9 +365,9 @@ function CommonSolve.solve!(sm::PMCSimulation;
351
365
report_metadata! (sm. report, " laststep" , last_step)
352
366
reset_flags = true
353
367
end
354
- if ! isnothing (walltime )
368
+ if ! isnothing (wall_time )
355
369
state = sm. state
356
- sm. state = @set state. simulation_plan. walltime = walltime
370
+ sm. state = @set state. simulation_plan. wall_time = wall_time
357
371
reset_flags = true
358
372
end
359
373
if ! isnothing (replica_strategy)
@@ -419,10 +433,10 @@ function CommonSolve.solve!(sm::PMCSimulation;
419
433
name = get_metadata (sm. report, " display_name" )
420
434
421
435
@withprogress name = while ! sm. aborted && ! sm. success
422
- if time () - starting_time > simulation_plan. walltime
436
+ if time () - starting_time > simulation_plan. wall_time
423
437
sm. aborted = true
424
- sm. message = " Walltime limit reached."
425
- @warn " Walltime limit reached. Aborting simulation."
438
+ sm. message = " Wall time limit reached."
439
+ @warn " Wall time limit reached. Aborting simulation."
426
440
else
427
441
step! (sm)
428
442
end
0 commit comments