Because the denominator must be positive, the objective function, and hence the optimization problem is convex, and can be readily formulated and solved using CVX or a similar convex optimization tool.

    cvx_begin
    variable x(n)
    minimize(sum(inv_pos(c + d.* x)))
    x >= 0
    sum(x) == C
    cvx_end

You change `x >= 0` to `x >= small_number` if you prefer. Strict inequalities are treated by the solvers as if they are non-strict inequalities.

It does not help to restrict x to integer values. That would make the problem more computationally difficult to solve. Nevertheless, to do so, merely change `variable x(n)` to `variable x(n) integer` .