Functions

Types and Structs

WeaklyHard.MConstant

A deadline miss – representated as UInt8(0) (equivalent to Miss)

source
WeaklyHard.HConstant

A deadline hit – representated as UInt8(1) (equivalent to Hit)

source
WeaklyHard.AutomatonType
Automaton()

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)
source

Constructors and Functions

WeaklyHard.build_automatonFunction
build_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)
source
WeaklyHard.transitionsFunction
transitions(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.

source
WeaklyHard.is_dominantFunction
is_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
source
WeaklyHard.is_equivalentFunction
is_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
source
WeaklyHard.is_satisfiedFunction
is_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
source
WeaklyHard.random_sequenceFunction
random_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.

source
WeaklyHard.all_sequencesFunction
all_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
source
WeaklyHard.dominant_setFunction
dominant_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)
source
Base.bitstringMethod
bitstring(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"
source