Skip to main content

Implementation issue (mixed integer linear model seem as quadratic)

Awaiting user input

Comments

6 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff Gurobi Staff
    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?.
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    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
  • ANIL KAYA
    Gurobi-versary
    First Comment
    First Question

    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
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    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 = 2

    works 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
  • ANIL KAYA
    Gurobi-versary
    First Comment
    First Question

    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
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    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.