I intend to do a proper writeup for this, in the meantime I published a short blog[1] with the program along with some background information.
[1] https://blog.phazon.xyz/answer-set-programming/2020/04/22/mu...
[1] https://blog.phazon.xyz/answer-set-programming/2020/04/22/mu...