Solution (source code)

= Solution

The least costly configuration contains one charge-$-1/2$ <nematic disclination>, placed near $(L/2,0)$ by the reflection symmetries of the boundary data. Away from its small core, the director interpolates as smoothly as possible between the wall anchoring and the two far-field textures. Locally around the defect one may sketch
$$
\theta(r,\varphi)=-\frac{\varphi}{2}+\theta_0.
$$
The elastic energy of an isolated defect scales as $q^2\log(R/a_{\rm core})$. Splitting the required total $-1/2$ charge into additional allowed half-charge defects is impossible without also adding compensating defects, which raises both the logarithmic elastic energy and the positive core energy. The single centered $-1/2$ defect is therefore the lowest-energy topology, up to smooth distortions and symmetry-related core placement.