To answer your specific question, to add a constant to a quadratic objective function, you can use the .Sum method of the cplex object. For example
cplex.AddMaximize(cplex.sum(quadExpr, cplex.Constant(10));
makes the objective function quadExpr + 10
.
Now, two comments on the rest of your post.
First, any linear transformation on the objective function will have no effect on your solution. So, if you are maximizing either
quadExpr
or
m * quadExpr + c
are equivalent for any (nonzero) constant m and constant c.
Next, Since the variables in your quadratic expression are binary, then you can almost always do better by formulating a mixed-integer linear model. To do this, you create an additional set of linear variables, say b[i][j] that will be 1 only if both x[i] and a[j] are both 1. You can enforce the property of b[][] by adding the constraints
b[i][j] <= x[i]
b[i][j] <= x[j]
If you are maximizing, and c[i][j] >= 0, then you don't need to explicitly enforce the converse, but if that's not the case, you can add
x[i] + x[j] <= 1 + b[i][j]