TITLE: How to sample a uniform random polyomino?
QUESTION [11 upvotes]: A polyomino is formed by joining finitely many unit squares edge to edge. It may be regarded as a finite subset of the regular square tiling with a connected interior. In particular, for us, polyominos may have holes.
(Update: these are sometimes also called two-dimensional lattice animals. For another model of random lattice animal, see this earlier MO question and discussion and references there.)
I would like to be able to sample a uniform random polyomino with $n$ squares, where $n$ is of the order $100$ or $1000$.
I am thinking of fixed polyominos, where two polyominos are considered equivalent only if they agree after a translation, but where rotations and reflections are in general distinct. But I might also be okay with sampling one-sided or fixed polyominos if that is for some reason easier or more natural.
The point is that I don't want to have to enumerate all the polyominos of this size. For $n=100$, enumerating all the polyominoes would already be far beyond the reach of modern computing. I am hoping that there is a random construction, or else a Markov chain that converges to the uniform distribution (i.e. every polyomino having equal probability). I would be interested in such a Markov chain, if it could be proved to converge to the uniform distribution, even without guarantees on the mixing time.
My first attempt at a random construction was to apply a randomized version of Redelmeier's method, or at least Wikipedia's description of this algorithm. But I am not sure if Wikipedia's description is correct. I copy it here, for the sake of completeness.

The basic idea is that we begin with a single square, and from there,
  recursively add squares. Depending on the details, it may count each
  n-omino n times, once from starting from each of its n squares, or may
  be arranged to count each once only.
The simplest implementation involves adding one square at a time.
  Beginning with an initial square, number the adjacent squares,
  clockwise from the top, 1, 2, 3, and 4. Now pick a number between 1
  and 4, and add a square at that location. Number the unnumbered
  adjacent squares, starting with 5. Then, pick a number larger than the
  previously picked number, and add that square. Continue picking a
  number larger than the number of the current square, adding that
  square, and then numbering the new adjacent squares. When n squares
  have been created, an n-omino has been created.
This method ensures that each fixed polyomino is counted exactly n
  times, once for each starting square.

I was hoping that by making a uniform random legal choice at each step, I could generate a large random polyomino, but unfortunately the description of the algorithm above seems to sometimes get stuck. See, for example, the figure below. We have consructed a polyomino with 16 tiles, but no further moves are possible.

REPLY [5 votes]: Here is an approach to estimating parameters of uniformly random polyominoes of $n$ squares without generating random ones uniformly.
First define a rooted tree whose root is the single square and whose nodes at distance $m$ from the root are the $m$-square polyominoes, with no nodes further than $n$ from the root. This is fairly easy: the parent of polyomino $P$ can be $P-s$ where $s$ is the most-northern most-western square such that $P-s$ is a polyomino.
Now you need a procedure that, given a polyomino $P$ tells you how many children it has and chooses a random child.  If nothing better comes to mind, just try adding a new square in each possible place and reject it if $P$ is not the parent.
Now start at the root and follow a random path down until you come to a leaf $L$ (with $m$ squares, say). At each node, choose a child uniformly at random. If $d_0,\ldots,d_{m-1}$ are the degrees (numbers of children) of the nodes along that path (excluding $L$), then $p(L)=(d_0\cdots d_{m-1})^{-1}$ is the probability that a random path ends at $L$.
Now, if $\chi(L)$ is the indicator function of "$L$ has $n$ squares", then the expectation of $\chi(L)/p(L)$ is exactly equal to the number of $n$-square polyominoes, so you can estimate that number by sampling repeatedly.  In fact, for any function $f$, the sum of $f(P)$ over all $n$-vertex polyominoes is exactly the expectation of $f(P)\chi(L)/p(L)$ for a random path.  This lets you estimate the expectation of $f$ by repeated sampling.
I've considered the simplest case, where all the children of a node are chosen with equal probability as a random path is traced.  The theory is valid for any distribution on the children. To get good estimates you would like the probability of choosing a child to be roughly proportional to the number of $n$-square polyominoes descended from that child. Then each $n$-vertex polyomino comes out with similar probability. If that is far from the truth, the estimates may have large variance even though they have the correct expectation.
This is an example of "sequential importance sampling". Searching on that phrase will bring up some papers; look for Diaconis in particular.  I've seen this work extremely well and extremely badly on different problems.