Integer optimisation with user's multivariate functions: Possible in Julia?

I’ve found a workaround, but maybe there’s a better solution. There’s an example script in my other question, How to avoid re-computing the same matrix in optimisation/JuMP? Many thanks!