(ii-b')¶
If the $i$-th square is in the state $j$ and the state $j$ takes white, then the $i+1$-th square is
in
the state $j$ (white) or the state $j+1$ (First-Black).
$$
\quad p_{i, j} \land (1-p_{i+1, j}) = p_{i+1, j+1} \quad (\forall j \neq W, s_j \in S_{\rm{white}})
$$
We implement this constraint using Amplify's penalty
function. First, the left-hand side of the above equation is transferred to the right-hand side
and
both sides are squared. The logical conjunction $\land$ can be converted to multiplication. This
right-hand side can be implemented as the penalty $P_b$ for this constraint:
$$
\quad P_b = \left[ p_{i, j} (1-p_{i+1, j}) - p_{i+1, j+1}\right]^2 \quad (\forall j \neq W, s_j \in
S_{\rm{white}}).
$$
We see that only set of $(p_{i,j}, p_{i+1,j}, p_{i+1,j+1})$ yielding $P_b=0$ satisfies this
constraint.
Expanding the above equation, we obtain:
$$
P_b = -p_{i,j}p_{i+1,j} - 2p_{i,j}p_{i+1,j+1} + 2\:{\color{red} p_{i,j}} \:p_{i+1,j}p_{i+1,j+1} +
p_{i,j}
+ p_{i+1,j+1} \quad (\forall j \neq W, s_j \in S_{\rm{white}}).
$$
Here, the above equation is treated as a penalty, and for a set of $(p_{i,j}, p_{i+1,j},
p_{i+1,j+1})$
that yields $P_b \neq 0$, $P_b$ does not need to be calculated exactly as long as the resulting $P_b
\neq
0$. Based on this idea, we can omit the term in red-colored font in the above equation, and avoid the
use
of third-order terms
that
require the introduction of auxiliary variables.
Finally, $P_b$ in the case of $$j\neq W$$ is,
$$
P_b = -p_{i,j}p_{i+1,j} - 2p_{i,j}p_{i+1,j+1} + 2p_{i+1,j}p_{i+1,j+1} + p_{i,j} + p_{i+1,j+1} \quad
(\forall j \neq W, s_j \in S_{\rm{white}})
$$
Also, if $j=W$, the above equation is reduced to:
$$
P_b = -p_{i,j}p_{i+1,j} + p_{i,j} \quad (j=W, s_j \in S_{\rm{white}})
$$
These two equations are implemented as a penalty function with respect to the white squares (to make
$P_b$ take a value as close to 0 as possible) as follows.