-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstate.jl
More file actions
37 lines (26 loc) · 1.15 KB
/
state.jl
File metadata and controls
37 lines (26 loc) · 1.15 KB
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
@doc """
State
An abstract type to represent the state an iterative algorithm is in.
The state consists of any information that describes the current step the algorithm is in
and keeps all information needed from one step to the next.
## Properties
In order to interact with the stopping criteria, the state should contain the following properties,
and provide corresponding `getproperty` and `setproperty!` methods.
* `iteration` – the current iteration step ``k`` that is currently being performed or was last performed.
* `stopping_criterion_state` – a [`StoppingCriterionState`](@ref) that indicates whether an [`Algorithm`](@ref)
will stop after this iteration or has stopped.
* `iterate` – the current iterate ``x^{(k)}``.
## Methods
The following methods should be implemented for a state
* [`increment!`](@ref)(state)
"""
abstract type State end
"""
increment!(state::State)
Increment the current iteration that a [`State`](@ref) is currently performing or was last performing.
The default assumes that the current iteration is stored in `state.iteration`.
"""
function increment!(state::State)
state.iteration += 1
return state
end