'is it possible to multiply two Gurobi linear expressions?

I want to perform the following operation in Gurobi for Java:

enter image description here

Create the summatory terms is easy through GRBLinExpr but I donwt know hot to multiply those two GRBLinExpr. is it possible?



Solution 1:[1]

No, but you can do this by adding intermediate variables for the sums, e.g. sx = sum(x[i]) and sy = sum(y[i]); then you can replace the product of the linear expressions by the product sx * sy.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Greg Glockner