NMinimize::belt
NMaximize::belt
An error occurs because the product 2x is not one of the variables:
NMinimize[{Cos[x], Element[2x, Integers]}, {x}]This shows a valid use of NMinimize to minimize a function with the constraint that the variable be an integer:
NMinimize[{Cos[x], Element[x, Integers]}, {x}]