Writing an integer optimization problem in appropriate form to use MIDCP

I am new with MIDCP.
I would like to use MIDCP to solve the following integer optimization problem.

Suppose the function f(x) is defined as
where c is integer constant and \lambda is constant.

The optimization problem is:
x=\mathrm{argmax}_{x} f(x)
subject to x_{min}<x<x_{max} and x is integer

My main problem is in the upper limit of the sum since when I use for or while loop ending at cx-1, I got the following error message:
“Disciplined convex programming error:
Constraints may not appear in if/then statements.”

I do appreciate your help.
Thank you

How about solving by “brute force”? Evaluate f(x) for every value of x within its bounds, and pick the value of x which has the maximum value of f(x)… Will that take too long?