Skip to main content

Nonlinear global optimization in pyomo (calling gurobi)

Answered

Comments

2 comments

  • Riley Clement
    • Gurobi Staff Gurobi Staff

    Hi Yingkai,

    It sounds like Pyomo wants to write the model to file, then invoke Gurobi via the command line.  It seems to be running into an error when writing the file.  If this is occurring with the latest version of Pyomo I would open up an issue at https://github.com/Pyomo/pyomo/issues

    As a workaround, can you try and use the "persistent" interface, which builds the model in Gurobi directly:

    solver = pyo.SolverFactory('gurobi_persistent')

    Of course you could also use gurobipy to solve the issue.  I'm sure ChatGPT could do a quick conversion between your Pyomo code to gurobipy code.

    - Riley

    0
  • Yingkai Song
    • Gurobi-versary
    • First Comment
    • First Question

    Hi Riley,

     

    Thanks for your reply! 

    Even though I could not find the source again, several days ago, I found a post from Gurobi saying that to use nonlinear term such as sin in Gurobi, I have to use Model.addGenContrSin() in gurobipy. This function of Gurobi is just incompatible with Pyomo's modeling language. 

    Thanks,

    Yingkai

    0

Please sign in to leave a comment.