Functions
WeaklyHard.H
WeaklyHard.Hit
WeaklyHard.M
WeaklyHard.Miss
WeaklyHard.AbstractAutomaton
WeaklyHard.AnyHitConstraint
WeaklyHard.AnyMissConstraint
WeaklyHard.Automaton
WeaklyHard.Constraint
WeaklyHard.RowHitConstraint
WeaklyHard.RowMissConstraint
WeaklyHard.WordVertex
Base.bitstring
WeaklyHard.all_sequences
WeaklyHard.build_automaton
WeaklyHard.dominant_set
WeaklyHard.is_dominant
WeaklyHard.is_equivalent
WeaklyHard.is_satisfied
WeaklyHard.minimize_automaton!
WeaklyHard.random_sequence
WeaklyHard.transitions
WeaklyHard.vertices
Types and Structs
WeaklyHard.Miss
— ConstantA deadline miss – representated as UInt8(0)
WeaklyHard.Hit
— ConstantA deadline hit – representated as UInt8(1)
WeaklyHard.M
— ConstantA deadline miss – representated as UInt8(0) (equivalent to Miss)
WeaklyHard.H
— ConstantA deadline hit – representated as UInt8(1) (equivalent to Hit)
WeaklyHard.WordVertex
— TypeA struct keep track of the current node and its direct children (if some exist).
WeaklyHard.AbstractAutomaton
— TypeAbstract representation of an automaton type
WeaklyHard.Automaton
— TypeAutomaton()
Automaton struct containing a dict to represent the vertices (including head) and transitions of the automaton.
- Key = Word (represented by integer).
- Value = WordVertex (containing current vertex and its direct children vertices)
WeaklyHard.Constraint
— TypeAbstract representation of a constraint type
WeaklyHard.RowHitConstraint
— TypeRowHitConstraint(x, k)
Constructor for RowHitConstraint.
WeaklyHard.RowMissConstraint
— TypeRowMissConstraint(x)
Constructor for RowMissConstraint.
WeaklyHard.AnyHitConstraint
— TypeAnyHitConstraint(x, k)
Constructor for AnyHitConstraint.
WeaklyHard.AnyMissConstraint
— TypeAnyMissConstraint(x, k)
Constructor for AnyMissConstraint.
Constructors and Functions
WeaklyHard.build_automaton
— Functionbuild_automaton(Lambda::T) where {T <: Union{Constraint, Set{Constraint}}}
Creates a minimal weakly-hard automaton according to the (set of) weakly-hard constraint(s) Lambda
.
NOTE: The function handles both single constraints and sets of constraints.
Examples
julia> build_automaton(AnyHitConstraint(1, 3))
Automaton{Int64} with 3 vertices:
{
WordVertex{Int64}(100 => ---, 001)
WordVertex{Int64}(010 => 100, 001)
WordVertex{Int64}(001 => 010, 001)
} with head: WordVertex{Int64}(1 => 10, 1)
julia> build_automaton(Set([AnyHitConstraint(1, 3), RowHitConstraint(2, 6)]))
Automaton{Int64} with 7 vertices:
{
WordVertex{Int64}(001101 => 011010, 000011)
WordVertex{Int64}(000110 => 001100, 001101)
WordVertex{Int64}(011001 => ------, 000011)
WordVertex{Int64}(011010 => ------, 110101)
WordVertex{Int64}(001100 => ------, 011001)
WordVertex{Int64}(000011 => 000110, 000011)
WordVertex{Int64}(110101 => ------, 000011)
} with head: WordVertex{Int64}(11 => 110, 11)
WeaklyHard.transitions
— Functiontransitions(automaton::Automaton)
Returns all the transitions in automaton
in the form of a set of pairs where each pair consists of (v1, v2, c12)
, i.e., the tail of the transition v1
, the head of the transition v2
, and the label of the transition c12
.
WeaklyHard.vertices
— Functionvertices(automaton::Automaton)
Returns all the vertices in automaton
.
WeaklyHard.is_dominant
— Functionis_dominant(l1, l2)
Returns whether the weakly-hard constraint l1
dominates l2
or not.
Examples
julia> is_dominant(AnyHitConstraint(1, 3), RowMissConstraint(1))
false
julia> is_dominant(AnyHitConstraint(1, 3), RowMissConstraint(2))
true
WeaklyHard.is_equivalent
— Functionis_equivalent(l1, l2)
Returns whether the weakly-hard constraint l1
is equivalent to l2
or not.
Examples
julia> is_equivalent(AnyHitConstraint(1, 3), RowMissConstraint(1))
false
julia> is_equivalent(AnyHitConstraint(1, 3), RowMissConstraint(2))
true
WeaklyHard.is_satisfied
— Functionis_satisfied(L, w)
Returns whether the word w
satisfies the constraint L
or not; here, L
can be either a single constraint or a constraint set.
Examples
julia> is_satisfied(AnyHitConstraint(1, 3), 595) # bitstring(595) = ...1001010011
true
julia> is_satisfied(AnyHitConstraint(1, 3), 600) # bitstring(600) = ...1001011000
false
WeaklyHard.random_sequence
— Functionrandom_sequence(automaton::Automaton, N::Integer)
The function takes an arbitrary walk of length N
in automaton
. Returns a sequence that satisfy all weakly-hard constraints used to build the automaton.
WeaklyHard.all_sequences
— Functionall_sequences(automaton::Automaton, N::Integer)
The function returns a set containing all sequences of length N
satisfying the constraints used to build the automaton. In other words, the function generates the satisfaction set of length N
sequences.
Example
julia> all_sequences(build_automaton(AnyHitConstraint(2, 3)), 5)
Set{Int8} with 9 elements:
22
13
15
29
27
31
30
14
23
WeaklyHard.dominant_set
— Functiondominant_set(Lambda::Set{Constraint})
Calculates the dominant constraint set given a set of weakly-hard constraints, Lambda
.
Examples
julia> dominant_set(Set([RowMissConstraint(1),
AnyMissConstraint(3, 5),
AnyMissConstraint(1, 7)]))
Set{Constraint} with 1 element:
AnyMissConstraint(1, 7)
WeaklyHard.minimize_automaton!
— Functionminimize_automaton!(automaton::Automaton)
Minimises the automaton representation of a set of weakly-hard constraints.
Base.bitstring
— Methodbitstring(w::BigInt [, n::Integer])
A String giving the literal bit representation of a big integer w
. If n
is specified, it pads the bit representation to contain at least n
characters.
Examples
julia> bitstring(BigInt(4))
"100"
julia> bitstring(BigInt(4), 5)
"00100"