Mutators - Gianfrancoalongi/murenzhuang GitHub Wiki

Mutators are part of the basic building blocks of the MRZ system and are primitive in nature. Each mutator is a node in the MRZ graph - represented by the hexagon in the digraph below

Mutator


Fundamental Mutator properties

Every Mutator is described through three fundamental properties

  1. Buffer number - the 7 in "Buffer: 7"
  2. Transformation function - the decrease in "Transform: decrease"
  3. Indexing array - the 4,1,2 in "[x_i]: 4,1,2"

Buffer Number (Buffer-N)

The Buffer number indicates how much memory the Mutator has - how much it can store of incoming data. A Mutator with Buffer-2 has a memory size of 2 - thus, it can store 2 data characters and then no more. When a third data element comes in - there is no more room to store anything, and so the Transformation function is applied on the data - as described by the Indexing array.

In the example below - the data "abc123" is sent to a mutator with Buffer-2 - I will step you through what happens

input: abc123
current: none
Buffer: empty
-------------------
input: bc123
current: a
Buffer: []
-------------------
input: c123
current: b
Buffer: [a]
-------------------
input: 123
current: c
Buffer: [a,b]
 !buffer is now full and the Mutator can not store any more data
 !transformation function to be applied with arguments according to indexing array

Transformation functions

The transformation function is a function that is pre-defined and manipulates data. The transformation functions can handle any amount of arguments. The full list of all available transformation functions can be seen on the Transformation functions page.

Indexing array [x_i]

The indexing array indicates the ordering of the data elements as they are passed to the Transformation function. Thus, the [x_i] (indexing array) indicates the argument order. A full Buffer-N Mutator always has N+1 indices available for passing arguments to the transformation function. Index 1 is for the first stored data element, 2 for the second stored, etc, all the way to index N for the Nth stored - and N+1 indicates the currently consumed data element.

Using the same example as for the Buffer-N I will step you through what happens - adding the indices at the end

input: abc123
current: none
[x_i]: []
-------------------
input: bc123
current: a
[x_i]: [1=a]
-------------------
input: c123
current: b
[x_i]: [1=a,2=b]
-------------------
input: 123
current: c
[x_i]: [1=a,2=b,3=c]
 !buffer is now full and the Mutator can not store any more data
 !transformation function to be applied with arguments according to indexing array

Combining the fundamental properties to create a Mutator.

I will now guide you through an example, step by step where we have the following mutator

Mutator
 Buffer-2
 Function: increase
 [x_i]: 2, 1, 3

The increase function (together with all other functions) is described on the Transformation page

input: abc123
current: none
output: []
Buffer: []
-------------------
input: bc123
current: a
output: []
Buffer: []
-------------------
input: c123
current: b
output: []
Buffer: [a]
-------------------
input: 123
current: c
output: []
Buffer: [a,b]
  ! buffer is now full - and we apply the transformation with the indices controlling the order
  increase 2, 1, 3
    and substituting the indices for the values
  increase b a c
    will output
  c b d
    now the buffer is cleared, and c is stored
--------------------
input: 23
current: 1
output: [c,b,d]
Buffer: [c]
--------------------
input: 3
current: 2
output: [c,b,d]
Buffer: [c,1]
  buffer is now full - and we apply the transformation with the indices controlling the order
  increase 2, 1, 3
    and substituting the indices for the values
  increase 1 c 2
    will output
  2 d 3
    now the buffer is cleared, and 2 is stored
--------------------
input: none
current: 3
output: [c,b,d,2,d,3]
Buffer: [2]
--------------------
input: none
current: none
output: [c,b,d,2,d,3]
Buffer: [2,3]

Thus, the output of the Mutator was cbd2d3 for the input sequence abc123