# Gibbs sampling with constraints

I am reading tutorials on Gibbs sampling for partition sampling in Dirichlet Process (Chinese Restaurant Process), and have been struggling to understand the terminology used in the tutorials. To simplify my question in order to minimize the background required for answering it:

Imagine that there is an integer parameter $t_k$, which I need to sample, and it always needs to satisfy an inequality constraint, i.e., $1\leq t_k\leq 10$. My question is really about these types of phrases

sample $t$ according to $F(t_k| \texttt{and some other stuff})$ satisfying the inequality constraint

what does according to mean in here? Shouldn't we sample $\alpha$ from the inequality range itself? I know sampled $t_k$s should reflect the mass distribution, but $F$ doesn't look like a probability, hence I am not sure how sampling can be done. For example, this is

\begin{align}\label{joint} F(t_k|...)=\frac{(c_\pi|d_\pi)_{T_\pi}}{(c_u|1)_{N_\pi}}S_{d_\pi}(n^\pi_k,t^\pi_k)S_{d_u}(n_k^u,t_k^u) \end{align}

where:

• $(c|d)_\pi$ is the generalized factorial function,
• $c$ is the concentration parameter, and $d$ is the discount parameter of CRP
• $S_d(n,t)$ is the Stiriling number of second type
• $n_k$ is the number of entities assigned to partition $k$
• $t_k$ is the number of partitions of type $k$
• $T$ is the total number of partitions
• $N$ is the total number of entities
• $u,\pi$ are referring to distributions in the hierarchical setting where $u$ is the parent of $\pi$ in the hierarchy.

To simplify: basically everything in the RHS of $F$ is given, and $t_k$ is what needs to be sampled. I am not sure how I can sample $t$ according to $F$.

The question is a little unclear, but this is what I understand. $t_k$ can take on value $1, 2, 3, \dots 10$.
All the quantities on the RHS are known, and you can actually calculate them. Your problem is that the RHS does not look like a probability. This could be because the "$=$" sign in $F(t_k \mid ...)$ might have been misused, and they probably meant $\propto$.
So the actual conditional pmf for $t_k = i$ will be $$F'(t_k = i \mid ...) = \dfrac{F(t_k = i \mid ...)}{\sum_{i=1}^{10} F(t_k = i \mid ...)}.$$
This will be a valid pmf. Since you said you known all the quantities, you can find the numerator and the denominator, and then draw $t_k = i$ using the probability associated with it.