Under what general conditions is the set $S := \left\{\int_{X}v(x)\pi(x)\,\mathrm{d}P(x) \mid \pi: X \to A\right\}$ closed? Let $X$ be a compact subset of $\mathbb R^n$ and let $A$ be a compact subset of $\mathbb R^k$. Let $P$ be a probability distribution on $X$ and $v$ be a $P$-measurable function from $X$ to $\mathbb R^{d \times k}$.

Assumption. $v$ is bounded on $X$, that is, there exists $R>0$ such that $\sup_{x \in X}\lVert v(x)\rVert_\text{op} \le R$.

Consider the set $S \subseteq \mathbb R^d$ defined by
$$
S := \left\{\int_{X}v\pi\,\mathrm{d}P \mid \pi \in \Pi\right\},
$$
where $\Pi$ is the set of $P$-measurable functions from $X$ to $A$.

Question 1. Under what general conditions is $S$ a closed subset of $\mathbb R^d$ ?

Perhaps even more generally,

Question 2. What is the closure $\overline S$ of $S$ in $\mathbb R^d$ ?


Partial solution when $P$ has countable support
Suppose $P = \sum_{i=1}^\infty w_i\delta_{x_i}$, for some $x_1,x_2,\dotsc \in X$, and $0\le w_1,w_2,\dotsc$, with $\sum_{i=1}^\infty w_i = 1$. Let $M_i := w_iv(x_i) \in \mathbb R^{d \times k}$ for all $i$. Then, one computes
$$
\begin{split}
S = \left\{\sum_{i=1}^\infty w_iv(x_i)\pi(x_i) \mid \pi \in \Pi\right\} &= \left\{\sum_{i=1}^\infty M_i a_i \mid a_1,a_2,\ldots \in A\right\}\\
& = B_1 + B_2 + \ldots,
\end{split}
$$
where $B_i := \{M_i a \mid a \in A\}$. It is clear that each $B_i$ is compact in $\mathbb R^d$. Because $C := B_1 \times B_2 \times \dotsb$ is compact and the funciton $f:C \to S$ defined by $f(b_1,b_2,\dotsc) := \sum_{i=1}^\infty w_i b_i$ is continuous, we deduce that $S$ is compact, and therefore closed.
 A: I guess that if $v$ is $P$-integrable then the answer is positive, and actually the set is compact.
Indeed, what you are looking for in this case is the compactness of the Aumann integral of the measurable multivalued integrably bounded function $v(\cdot)A$ with compact values in a finite-dimensional space.
In Aumann's original paper (Robert J. Aumann, Integrals of set-valued functions, J. Math. Anal. Appl. 12 (1965), 1-12) the compactness of the integral is proved in this case for the Lebesgue measure (Theorem 4), hence the result follows if $P$ has no atoms (Edit: and is separable, see comments below).
I guess that the proof for general measure spaces with atoms is similar, especially since your argument shows that it holds if the measure space is purely atomic. Probably somebody has carried out the proof, though I do not know a reference.
A: Disclaimer: This would be too long of a comment, so posting here instead to get some input. This is an attempt to get a handle on user Martin Vath's answer. Thanks in advance.

Let $P$ be probability distribution on a compact subset $X$ of $\mathbb R^n$, and let $F$ be a collection of $P$-measurable functions.
We are interested in the compactness of the set-valued integral
$$
S:=\int_X F\,dP = \left\{\int_X f\,dP \mid f \in F\right\}.
$$
Suppose $F$ is uniformly bounded, i.e., $b := \sup_{f \in F}\|f\|_\infty < \infty$, and for any
For any $t \in [0,b]$ and $f \in F$, define
$$
P_t(f) := P(\{x \in X \mid f(x)>t\}).
$$
By the layer-cake representation, one can write
$$
S := \int_X F\,dP = \int_0^bP_t(F)\,dt,
$$
where $P_t(F) := \{P_t(f) \mid f \in F\}$.

Thanks to Theorem 4 of Aumann 1965 (the paper cited by Martin Vath, for $S$ to be compact, it suffices that $P_t(F)$ be closed for (almost) any $t \in [0,b]$.

In my specific question (and taking $d=1$ for simplicity), $F$ is collection of functions of the form $x \mapsto v(x)\cdot \pi(x)$, where $v:X \mapsto \mathbb R^k$ is a bounded $P$-measurable function function and $\pi$ runs over $P$-measurable functions $X \mapsto A$, with $A$ being a fixed compact subset of $\mathbb R^k$.
Moreover, to ensure $F$ is uniformly bounded, it suffices to demand $v$ be bounded; we can then take $b = \mathrm{diam}(A)\cdot\sup_{x \in X}\|v(x)\|<\infty$.

Question. For such an $F$, is it true $P_t(F)$ is closed for (almost) any $t \in [0,b]$ ?

Partial solution when $P$ has countable support
Suppose $P = \sum_{i=1}^\infty w_i \delta_{x_i}$, with $(x_i)_i \subseteq X$ and $(w_i)_i \in \ell^1(\mathbb R)$. Then, a direct computation gives
$$
\begin{split}
P_t(F) &= \left\{\sum_{i=1}^\infty w_i1_{v(x_i)\cdot \pi(x_i)  \,>\, t} \mid \pi \in \Pi\right\}\\
&=\left\{\sum_{i=1}^\infty w_i1_{v(x_i)\cdot a_i  \,>\, t} \mid (a_i)_i \subseteq A\right\}\\
& = \sum_{i=1}^\infty w_i u_i(A)\text{ (Minkowski sum)},
\end{split}
$$
where $u_i(a) := 1_{v(x_i)\cdot a \,>\, t} \in \{0,1\}$. Thus, we see that $P_t(F)$ is a subset of values for the subsums of $\sum_{i=1}^\infty w_i$, and so must be closed (since there are only countably many distinct values for these subsums). We thus recover the result established in the original question.
A: Disclaimer. This post is mostly to provide some low-level details for Martin Vath's answer and comments. Note that my previous post https://mathoverflow.net/a/421367/78539 didn't quite correspond to what Martin Vath intended, though it still ends up solving the problem for the special case of countably supported $P$.

We shall work under the following assumption:

Asumption 1. For the function $v:X \to \mathbb R^{d\times k}$ in the question, $\|v\|:x \mapsto \|v(x)\|_{op}$ is $P$-integrable.

Method 1: Via Maraham's theorem
The separable probability measure space $(X,P)$ can be decomposed into the sum of an atomic part (i.e with countable support) and a non-atomic part (i.e containing no atoms) which is isomorphic to $L:=([0,1],\mathcal B([0,1]), dx)$, the standard Lebesgue space. The set $S$ in the question then decomposes as a Minkowski sum of isomorphic images of the versions $S$ corresponding to each part of this decomposition.

Thus, we only need to study the compactness of $S$ in the case where the original probability space $(X,P)$ is atomic (done!) and the case where it is the standard Lebesgue space $L$.

Thus, let $(X,P) = L$, the standard Lebesgue measure space. Consider the set-valued map $F:X \to 2^{\mathbb R^d}$ defined by
$$
F(x) := v(x)\cdot A := \{v(x) a \mid a \in A\},
$$
Then, the set $\mathcal S$ in the original question can be written as the Aumann integral of $F$ over $X$, i.e
$$
S = \int_X F\,dP := \left\{\int_X f\,dP \,\,\big |\,\, f \in \mathfrak F\right\},
$$
where $\mathfrak F$ be the collection of all integrable functions $f:X \to \mathbb R$ such that $f(x) \in F(x)$ for all $x \in X$.
We observe the following:

*

*Since $A$ is closed (compact), $F(x):=v(x)A$ is closed (compact) for every $x \in X$.

*Since $A\subseteq \mathbb R^k$ is compact, it is clear that $F$ is integrably bounded by the function $h:X \to \mathbb R_+$ defined by $h(x):=\mathrm{diam}(A)\cdot\|v(x)\|_{op}$, meaning that $h$ is $P$-integrable and
$$
\|z\| \le h(x),\text{ for every }x \in X, \,z \in F(x).
$$

It then follows from Theorem 4 of Robert J. Aumann, Integrals of set-valued functions, J. Math. Anal. Appl. 12 (1965), 1-12) that $S$ is compact.

Method 2: via Debreu-Aumann equivalence

Assumption 2. $A$ is convex.

Under Assumption 1 and Assumption 2, the compactness of the set $S$ defined in the original question follows from Theorem 3.11 of Sambucini (1999). However, it is a bit trickier to verify all the hypotheses: "total measurability of $F$", etc.

Possible issue. Something which appears weird is that Method 2 seems to require convexity of $A$ while Method 1 doesn't.

