I would like to choose a set of $\beta_j$s that maximizes a simple linear objective function of the type
$$ \underset{\beta_j}{\operatorname{max}}\sum_{j=1}^{J}X_j\beta_j \\ $$
subject to the following constraints $$ \sum_{j=1}^{J}C_j(\beta_j)\beta_j \le M \\ \beta_j \in \Omega \\ $$
here $C_j(\beta_j)$ can be thought as a marginal cost function that changes with the chosen $\beta_j$. $\beta_j$ can only be from a set of pre-selected set of integers $\Omega$. $M$ is some budget constraint.
I don't know the functional form of $C_j(\beta_j)$ but can simulate $C_j$ for each $j$ and each possible $\beta_j$.
I am having trouble understanding how to optimize this problem efficiently. Can someone give any direction on how this can be solved in R or Python?