algorithm to obtain the desired value of $\beta$. This parameter $\beta$ is less meaningful for solitary wave collisions in shallow water, so we use $\theta$ itself as the traveling parameter in the present study. We also need to specify the amplitude of the wave. This can be done in various ways, e.g. by specifying the value of the energy, $$E = \frac{1}{2\pi}\int_0^{2\pi} {\textstyle}\frac{1}{2}\varphi{\mathcal{G}}\varphi
  + \frac{1}{2}g\eta^2\,dx,$$ by constraining a Fourier mode such as $\hat\eta_1(0)$, or by specifying the initial height of the wave at $x=0$: $$\eta(0,0) = \hat\eta_0 + \sum_{k=1}^{n/2} 2c_{2k-1}.$$ Thus, to enforce (\[eq:even:odd\]), we can minimize the objective function $$\label{eq:f}
    f(c) = \frac{1}{2} r(c)^Tr(c),$$ where $$\begin{aligned}
\label{eq:r:def}
    r_1 = \big(\;\text{choose one:} \quad
    & E-a \quad,\quad
    \hat\eta_1(0)-a \quad,\quad
    \eta(0,0)-a \;\big), \\ \notag
    r_{2j} = {\operatorname{Im}}\{e^{ij\theta/2}\hat\eta_j(T/2)\}, \qquad 
    &r_{2j+1} = {\operatorname{Re}}\{e^{ij\theta/2}\hat\varphi_j(T/2)\}, \qquad
    (1 \le j\le M/2).\end{aligned}$$ Here $a$ is the desired value of the chosen amplitude parameter. Alternatively, we can impose (\[eq:ts:def\]) directly by minimizing $$\label{eq:f1}
  \tilde f = \frac{1}{2}r_1^2 + \frac{1}{4\pi}
  \int_0^{2\pi} \left(\big[\eta(x,T)-\eta(x-\theta,0)\big]^2 +
  \big[\varphi(x,T)-\varphi(x-\theta,0)\big]^2\right)dx,$$ which also takes the form $\frac{1}{2}r^Tr$ if we define $r_1$ as above and $$\label{eq:r1:def}
  \begin{aligned}
    r_{4j-2}+ir_{4j-1} &= \sqrt{2}\left[ \hat\eta_j(T) - e^{-ij\theta}\hat\eta_j(0) \right], \\
    r_{4j}+ir_{4j+1} &= \sqrt{2}\left[ \hat\varphi_j(T) - e^{-ij\theta}\hat\varphi_j(0) \right],
  \end{aligned} \qquad\quad (1\le j\le M/2).$$ Note 