Observation 0: Given a finite set $X$, the probability distribution on $X$ with highest entropy is the uniform one. This is well known.
Observation 1: Given two finite sets $X,Y$ and two probability distributions, $p$ on $X$ and $q$ on $Y$, there always exists a probability distribution on $X\times Y$ which has these given distributions as marginals, namely the one $p(x)\,q(y)$ whose projections are independent, and it is the one with highest entropy. (See here and here.)
Question: Given three finite sets $X,Y,Z$ and three probability distributions, $p$ on $X\times Y$, $q$ on $X\times Z$ and $r$ on $Y\times Z$:
how can I decide (in function of $p,q,r$) whether there is a probability distribution on $X\times Y\times Z$ which has these given distributions as pairwise marginals? (I mean, is there a simpler way to state this than by writing the obvious linear feasibility problem expressing it?)
and more importantly, assuming there is one, how can I compute (in function of $p,q,r$) the one with highest entropy? does this distribution (or this problem) at least have a name?
I am interested both in what can theoretically be said about this problem/distribution, and about computing it in practice. We can assume $|X|=|Y|=|Z|=2$ if this is of help.
(A similar question was asked here, but it's not quite the same setup, and not as symmetric.)