  The Gross-Pitaevskii-Poisson equations that govern the evolution of
self-gravitating Bose-Einstein condensates, possibly representing dark matter
halos, experience a process of gravitational cooling and violent relaxation. We
propose a heuristic parametrization of this complicated process in the spirit
of Lynden-Bell's theory of violent relaxation for collisionless stellar
systems. We derive a generalized wave equation (that was introduced
phenomenologically in [P.H. Chavanis, Eur. Phys. J. Plus {\bf 132}, 248
(2017)]) involving a logarithmic nonlinearity associated with an effective
temperature $T_{\rm eff}$ and a damping term associated with a friction $\xi$.
These terms can be obtained from a maximum entropy production principle and are
linked by a form of Einstein relation expressing the fluctuation-dissipation
theorem. The wave equation satisfies an $H$-theorem for the Lynden-Bell entropy
and relaxes towards a stable equilibrium state which is a maximum of entropy at
fixed mass and energy. This equilibrium state represents the most probable
state of a Bose-Einstein condensate dark matter halo. It generically has a
core-halo structure. The quantum core prevents gravitational collapse and may
solve the core-cusp problem. The isothermal halo leads to flat rotation curves
in agreement with the observations. These results are consistent with the
phenomenology of dark matter halos. Furthermore, as shown in a previous paper
[P.H. Chavanis, Phys. Rev. D {\bf 100}, 123506 (2019)], the maximization of
entropy with respect to the core mass at fixed total mass and total energy
determines a core mass--halo mass relation which agrees with the relation
obtained in direct numerical simulations. We stress the importance of using a
microcanonical description instead of a canonical one. We also explain how our
formalism can be applied to the case of fermionic dark matter halos.
