202501162201

Tags : Weighted Automata and Transducers

Algorithm for Finding the Weight of a Word


This is the WA variant of checking for acceptance of a word.


Lazy Power Set Idea

This algorithm is similar to that of the lazy power set construction for checking an acceptance of a word in a Non-Deterministic Finite State Automata.

The Idea is to start with a set of start states, along with the weights, and then on each step apply the transition to all states to obtain the new set of weights. If two different states go to the same one, then add their weights.

Algorithm:

  • Let be a set of start states along with their start weights.
  • For in :
    • For each in and each transition in the set of transtions, add to with the weight multiplied to the weight with .
    • For and in , replace it with until there are no repeated.
      • This step is what keeps the time complexity good and is only possible because of
    • Replace with
  • Multiply the final state weights to all every state in and add them together.


Matrix Implementation

After alphabets are read, one can think of the set of states and weights associated with them as a sized vector.

If one represents the state of the weighted automata in that manner, then transition by reading a letter can be written as

Where .

Algorithm:

  • Write as a matrix, as a matrix and for each construct from .
  • Let
  • For :
  • return

Here starts as a matrix and is multiplied by a sequence of matrices, so the order remains the same.

In the final step, is multiplies by giving a matrix formed by multiplying final values for each state and adding them up.


References