In the Oscillator Cellular Automata each cell is an oscillator interacting with the neighbor cells in order to reach synchronization.
This simulation contains a squared grid of cells $C: m\times n$, for $m,n \in \mathbb{N}^+$ where each cell is represented as $c_{ij} \in C$, for $i=1\ldots n$, $j=1\ldots m$. Each cell $c_{ij}$ executes the sinoidal function:
$$y(t) = A(t) \cdot sin(f(t) \cdot t + d(t))$$
Where:
$t \in \mathbb{N}^+$ is the time index, or the iteration number in CA simulation;
$y(t) \in \mathbb{R}$ is the wave value at time $t$;
$A(t) \in \mathbb{R}^+$ is the wave amplitude at time $t$ and is initialized such as $A(0) \sim \mathcal(0,2)$;
$f(t) \in \mathbb{R}^+$ is the wave frequency at time $t$ and is initialized such as $f(0) \sim \mathcal(0,1)$;
$d(t) \in \mathbb{R}$ is the wave phase displacement at time $t$ and is initialized such as $d(0) \sim \mathcal(-1,1)$;
Each cell $c_{ij}$ can be represented as:
$$ c_{ij} = \{ \theta_{ij}(t), s_{ij}(t), N(i,j) \} $$
Where:
$\theta_{ij} = [A_{ij}(t), f_{ij}(t), d_{ij}(t)]$ is the internal state at time $t$;
$s_{ij} \in \mathbb{N}^+$ is the external (or output) state at time $t$;
$N(i,j)$ the set of surrounding neighbors
It is important note that all parameters of each cell, except its neighborhood, are time-varying and should be referred with the time index $t$.
Output Cell States
The output state $s_{ij}$ of each cell $c_{ij} \in C$, also called the cell's activation, means the amount of neighbors $n\in N(i,j)$ whose oscillators are synchronized, e. g., the wave values $y(t)$ are equal or close by a proximity radius of $\epsilon$. The parameter $\epsilon \in \mathbb{R}^+$ is the closeness radius and control the minimal level of proximity the wave values must have to be considered synchronized, such that $y_{ij}(t) - \epsilon \leq y_n(t) \leq y_{ij}(t) + \epsilon$. The final computation of state is given by:
$$
s_{ij}(t+1) = \sum_{n \in N(i,j)} \mathbb{1}(y_{ij}(t) - \epsilon \leq y_n(t) \leq y_{ij}(t) + \epsilon)
$$
Once $C$ is a square grid, $N(i,j)$ return the 8 surrounding neighbors, $s_{ij}$ will be in $[0,8]$ interval and the color intensity will reflect $s_{ij}$ in shades of gray.
Updating Cell States
During the simulation, all cells interact with its neighbors trying to synchronize its waves. The current method of syncronization is based in the Gradient Descent method, which employs the difference of wave values as loss function:
$$ L(c_{ij}, c_{kl}) = \Delta y(t) = y_{ij}(t) - y_{kl}(t) $$
Given an internal state $\theta(t)$, the Gradient of $L$ is given by:
$$\nabla_\theta = \left[ \frac{\partial A}{\partial L}, \frac{\partial A}{\partial L}, \frac{\partial A}{\partial L} \right]$$
The $\alpha \in mathbb{R}^+$ is the learning rate.
The Gradient Descent method updates the internal state using the following formula:
$$ \theta(t+1) = \theta(t) + \alpha \cdot -\nabla_\theta $$