Implementation of the algorithm developed in the work of Zhang et. al (https://doi.org/10.1103/PhysRevA.97.052333). The following code uses Deep Reinforcement Learning to obtain an optimal sequence of magnetic fields to be applied at the extremes of a spin chain in order to achieve perfect transmission of a quantum state.
We consider an homogeneous XX hamiltonian describing a quantum spin chain that can be under the influence of magnetic pulses in discrete periods of time:
Following the work of Zhang et. al, consider 16 possible combinations of pulses that can be applied to the extremes of the chain.