Creating a matrix of variables in optim

This thread is more in-depth with the same problem: https://discourse.julialang.org/t/translating-jump-variables-to-optim/11607