  We propose a machine-learning inspired variational method to obtain the
Liouvillian gap, which plays a crucial role in characterizing the relaxation
time and dissipative phase transitions of open quantum systems. By using the
"spin bi-base mapping", we map the density matrix to a pure
restricted-Boltzmann-machine (RBM) state and transform the Liouvillian
superoperator to a rank-two non-Hermitian operator. The Liouvillian gap can be
obtained by a variational real-time evolution algorithm under this
non-Hermitian operator. We apply our method to the dissipative Heisenberg model
in both one and two dimensions. For the isotropic case, we find that the
Liouvillian gap can be analytically obtained and in one dimension even the
whole Liouvillian spectrum can be exactly solved using the Bethe ansatz method.
By comparing our numerical results with their analytical counterparts, we show
that the Liouvillian gap could be accessed by the RBM approach efficiently to a
desirable accuracy, regardless of the dimensionality and entanglement
properties.
