Can the number of terms in optimization objective function follows a distribution? In a mathematical optimization, is it possible that the number of terms follows a distribution? 
For example, if the objective function is:
$$
\operatorname{Minimize}\sum_{i=1}^N f(x_i)\\
S.t \quad ...
$$
and function $f(x)$ is convex and equal for all i's. Is it possible that we assume N follows a uniform distribution?
Then how we should solve it under this assumption(or what kind of optimization it become)?
What if $f$ is not convex?
I'm not sure of the possibility. Therefore, any clue on what I should looking for is appreciated.
Thanks
 A: Since we are trying to minimize an objective function, the function must take values in a totally ordered space, usually $\mathbb{R}$. Since $g(x_1, ..., x_N) :=\sum_{i = 1}^N f(x_i)$ is a random variable, it doesn't make sense to ask what values of $x := (x_1, ..., x_N)$ will minimize $g$. In stochastic optimization we instead usually ask for $x$ that minimizes the $\textit{expectation}$ of an objective function containing stochastic elements, or something similar.
Since the number of decision variables in the problem you formulated is itself stochastic, however, it looks like you actually need to determine a (possibly infinite, depending on $N$) family $\{x^n\}_{n \in \mathbb{N}}$ of decision vectors, where $x^n = (x_1, ..., x_n)$, before you can think about taking expectations. Feasible families would give you a policy telling you which $x_i$ to choose given a particular realization $N = n$.
Given that we're trying to find an optimal policy of sorts, I suspect that any problem that you could write in this way would be better handled using stochastic control, possibly by formulating it as a Markov Decision Process.
