In Gurobi, the quadratic constraints do not work, meaning the optimization results do not satisfy the specified squared term constraints
AnsweredHi everyone,
The natural-gas system satisfies the mass conservation law of fluid dynamics and Bernoulli equation in the operation.The gas flow of pipelines and gas pressure of gas nodes are
interrelated which can be modeled as presented below.The optimization results satisfy the constraint related to pipeline gas flow (Constraint 1), but do not satisfy the pressure-related squared constraints (Constraint 2).
%Constraint 1 is as follows:
for t = 1: n_T
C = [C, GasFlow(:,t) == (G_yY_in(:,t) + G_yY_out(:,t)) / 2];
end
%Constraint 2 is as follows:
for i = 1: n_GasBranch
f_bus = GasBranch(i,2);
t_bus = GasBranch(i,3);
for t = 1: n_T
C = [C, GasFlow(i,t)^2 == Cij(i)^2 * abs(GasPressure(f_bus,t)^2 - GasPressure(t_bus,t)^2)];
end
end
-
Hi,
This article might help: How do I diagnose a wrong result?
Also, I suggest you start by sorting out what the current situation is. For example:- What constraints are you trying to write?
- What values do the variables take in the solution you want?
- What is the actual solution obtained and how does it differ from the desired result?
In addition, it may be useful to export the model to an LP file to verify that the model is constructed as expected. How do I export a model from Gurobi?
Thanks,
Ryuta0
Please sign in to leave a comment.
Comments
1 comment