I have a mixed integer quadratic problem and my objective function is as follows
$$\arg \min \operatorname{Var}(f(x),g(x)) + \operatorname{Var}(c(x),d(x)) + \cdots$$
where $f$, $g$, $c$ $d$ are linear functions and $Var$ indicates variance and $x$ is a vector of 3000 binary variables.
If I want to solve the problem with mixed integer quadratic solver in gurobi I have to define it in the following form:
$$\ x^T Q x + q^T x $$
as the problem is defined in a high level format and there are large set of variables and coefficients , I have no idea how to extract $Q$ and $q$