Your understanding is incorrect - variables are variables, and can be continuous, binary, integer, ... However, the quadratic components of an expression x'Qx + a'x + b are, however, handled separately from the linear part.
As you can see in Example 2.2, we create the variables here: add_cvars!(model, [1., 1.], 0., Inf) could be ivars or bvars, your choice. Then we set the quadratic part of the objective: add_qpterms!(model, [1, 1, 2], [1, 2, 2], [1., 1., 1.]) the linear part being handled by the variable constructor (all 0s) We then make some constraints. Do you need to use Gurobi.jl directly? Its a fairly thin wrapper around the C API, and most people would access it through JuMP or Convex.jl. On Saturday, January 17, 2015 at 11:49:29 PM UTC-5, Micah McClimans wrote: > > Thank you, however I've read those very sections thoroughly, and as far as > I can tell adding QP variables is distinct from adding linear integer > variables. There is no clear explanation of how to force QP variables to be > integers. > > On Saturday, January 17, 2015 at 7:43:09 PM UTC-5, Joey Huchette wrote: >> >> Hey Micah, >> This is definitely possible, provided your quadratic constraints are >> convex or second-order cone representable. See this section >> <https://github.com/JuliaOpt/Gurobi.jl#quadratic-programming-examples> >> of the readme for how to set up a QP, and this section >> <https://github.com/JuliaOpt/Gurobi.jl#mixed-integer-programming> for >> how to specify integer variables. Also check out our modeling package >> JuMP <https://github.com/JuliaOpt/JuMP.jl> for an algebraic modeling >> language that I’d recommend using over the lower-level Gurobi interface >> directly. >> >> Also, there’s a julia-opt mailing list >> <https://groups.google.com/forum/#!forum/julia-opt> we’ve set up for >> these types of questions related to optimization in Julia. >> >> On Saturday, January 17, 2015 at 6:19:59 PM UTC-5, Micah McClimans wrote: >> >> I'm trying to figure out how to set up a Mixed Integer Quadratic Program >>> in Gurobi through Julia, and I'm not seeing how to do it. I'm not seeing >>> anything in the source code that even suggests that it can be done, but >>> since I can't see anything in the Gurobi docs explaining how to do it >>> either, I could very well be missing something important. I'd like to avoid >>> actually modifying the Gurobi package, since I could easily screw something >>> up, but if MIQP can't be done in Gurobi/Julia, I suppose I would. >>> >> >> >
