I want to maximize the sum of a nonlinear function $f(.)$ w.r.t. $x$ that is convex in $x$: $$\max \sum_{i=1}^N f(x_i), $$where $x_i$ is a continuous variable and $0 \le x_i < 1$ for $i = 1, 2, \dots , N$.
But in this problem, $x_i$ is restricted to be an element of the set $a = \lbrace a_1, a_2, a_3 \rbrace$, where $a_j$ is also a continuous variable and $0 \le a_j < 1$ for $j = 1, 2, 3$.
The problem is thus to maximize the objective function in w.r.t. of $x_i$ for $i= 1, 2, \dots , N$, where $x_i$ has to belong to the set $a$ and $a_j$ also is unknown and thus a decision variable.
There is one more constraint:
$$\beta = \frac{\sum_{i=1}^N D_i x_i }{\sum_{i=1}^N D_i},$$
where $D_i$ is a known constant for each $i$ and $\beta$ is again a constant with $0 \le \beta < 1$. $D_i$ and $\beta$ are thus outside of the model.
Is there a way to formulate this as an NLP problem?