My problem doesn't require the variables to be directly in the objetive function, only the related data. So if I don't put the variables in there, the objective function has no link to the variables and the model doesn't work properly, but if I do put it there the variable values interferes with my function. Is there a better way to do this?
This is my objective function: the sum of (r[i] * v[i]) with r[i] being the return value of a given variable x[i] and same goes for v[i], but instead of return it's variance
With r being returns and v variances.
The code I have so far:
model = Model()
x = model.continuous_var_dict(keys, name='invs')
model.maximize(model.sum(x[i] * (return_dict[i] / var_dict[i]) for i in x.keys()))
Any help is appreciated!