Max vs min is easy (set fnscale=-1
in the control
parameter).
Integer parameters are not easy. Such problems are called mixed integer programming problems and most available methods only handle mixed linear or quadratic problems. From the Optimization Task View:
MIP (Mixed integer programming and its variants MILP for LP and MIQP for QP, 90C11): glpkAPI, lpSolve, lpSolveAPI, Rcplex, Rglpk, Rmosek, Rsymphony
(I'm not very familiar with these methods.)
Most of the methods implemented in optim
assume continuous parameter spaces. (method="SANN"
will work since you can give it explicit rules for updating - see the examples - but it's tricky to get it to work efficiently.) Most of the optimizers listed in the Optimization Task View are for continuous optimization - the section on global/stochastic gives the most options for mixed discrete/continuous problems.
If the range of plausible integers is reasonably small you can use brute force (i.e., optimize over the two continuous parameters for each of a range of fixed integer values); you could also use bisection search over the integers.