User defined objective function to run MICP

Thank you for suggesting Bonmin in C++, but I would like to try that later if this does not work in Julia. Indeed Pavito can use IpoptSolver as cont-solver and I have tried it as follows, but Julia returned an error.

using JuMP, Pavito
nx = 100
c = 10
F = rand(nx, nx)

function my_obj(w...)
    M = eye(nx)
    for i = 1 : nx
        M += w[i] * F[:, i]' * F[:, i]
    end
    return trace(inv(M))
end

mip_solver_drives = true
rel_gap = 1e-5

using CPLEX
mip_solver = CplexSolver(
    CPX_PARAM_SCRIND = (mip_solver_drives ? 1 : 0),
    CPX_PARAM_EPINT = 1e-8,
    CPX_PARAM_EPRHS = 1e-7,
    CPX_PARAM_EPGAP=(mip_solver_drives ? 1e-5 : 1e-9)
)

using Ipopt
cont_solver = IpoptSolver(print_level = 0)

solver = PavitoSolver(
    mip_solver_drives = mip_solver_drives,
    log_level = 1,
    rel_gap = rel_gap,
    mip_solver = mip_solver,
    cont_solver = cont_solver,
)

model = Model(solver = solver)
JuMP.register(model, :my_obj, nx, my_obj, autodiff = true)
w = @variable(model, [j = 1 : nx], Bin, lowerbound = 0, upperbound = 1)
@constraint(model, sum(w) <= c)
@NLobjective(model, Min, my_obj(w))

Error message: LoadError: Incorrect number of arguments for “my_obj” in nonlinear expression. This is also related to a previous question: https://discourse.julialang.org/t/passing-an-array-of-variables-to-a-user-defined-non-linear-function/4132.

Currently I use auto-diff in the code, but I will provide gradient after the code can run for the simpler case. Could you give some advice on how I should define the function ?