Implementation issue (mixed integer linear model seem as quadratic)
Awaiting user inputI am working on stochastic mixed integer linear model via Julia scientific program. According my formulation, random variables (I fixed them) are multiplied by decision variables (as below). These lines seem as Quadratic by Gurobi optimizer and not solved. However, from theoretical perspective, this is not quadratic program. Could you please support ?
JuMP.@constraint(subproblem, const10[s in S], Ech[t,s]== Eidch[t,s]+rn*Pifcrn[t,s]+Eimch[t,s])
JuMP.@constraint(subproblem, const11[s in S], Edc[t,s]== Eiddc[t,s]+rp*Pifcrp[t,s]-Eimdc[t,s])
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi,
How exactly did you fix the variables? Did you introduce equality constraints to fix the optimization variables, e.g.,
JuMP.@constraint(subproblem,const10[s in S],Pifcrn[t,s] == 1)
In this case, Gurobi will still handle the problem as a quadratic one because both terms \(\texttt{rn}\) and \(\texttt{Pifcrn[t,s]}\) are optimization variables. This is because the first check for the model type at hand is done before any fixing are performed.
In order to circumvent this issue, you can fix one of the optimization variables by introducing it as a real constant parameter or setting the lower and upper bound of the optimization variable to the same value.
Best regards,
Jaromił0 -
Thank you for your feedback. This is a stochastic optimization. Uncertain parameters are fixed as below.
Ω = [(epsilon = w, rp=ll, rn=kk) for w in [0.0, 0.1, 0.2] for ll in [0.0, 0.05, 0.1] for kk in [0.0, 0.05, 0.1]]
rpp=[1/3, 1/3, 1/3]
rnn=[1/3, 1/3, 1/3]
eps=[1/3, 1/3, 1/3]
P=[]
for ep in eps, rn1 in rnn, rp1 in rpp
prok=ep*rn1*rp1
append!(P, prok)
end
uncertainty = Uncertainty(Ω,P) do ω
JuMP.fix(rp, ω.rp)
JuMP.fix(rn, ω.rn)end
0 -
This is interesting. I just tested a small Python example with
m.addConstr(x==2)
m.addConstr(x*y == 1)and it solves. Setting
x = m.addVar(vtype=GRB.CONTINUOUS, lb=2, ub=2, name="x")
also works. Using
x = m.addVar(vtype=GRB.CONTINUOUS, name="x")
x.lb = 2
x.ub = 2works as well. So I guess that JuMP performs a slightly different change but I cannot tell which one. You could try reaching out to the developers in their GitHub (I guess this is the best option here).
For now, you can set the NonConvex parameter to 2 to make Gurobi solve your problem. You can set it via
model = Model(Gurobi.Optimizer)
set_optimizer_attribute(model, "NonConvex", 2)Best regards,
Jaromił0 -
Thank you for your explanation. Sure, I will check.
Regarding your last comment, it is not working with NonConvex=2. It also wanted the following parameter: QCPDual=1
After this (QCPDual=1), it is working only one iteration. If iteration limit is more than 1, it is not working too. It is interesting.
0 -
This is suspicious. What exactly is the error you see? Could you write the MPS file from JuMP as described in How do I write an MPS model file from a third party API? and try to solve it with Gurobi without the JuMP interface? You can use the Gurobi command line tool to solve the generated MPS file.
Best regards,
Jaromił0
Post is closed for comments.
Comments
6 comments