Skip to main content

Large LP problem



  • Matthias Miltenberger
    Gurobi Staff Gurobi Staff

    Hi Amin,

    LPs are usually solved until optimality. Gurobi does not provide an easy way to query the best found primal feasible LP solution. You can use the Simplex callback to query the primal and dual violations as well as the current objective value (check the callback example). The solution itself is not accessible, though.

    Please note that you would also need to set the Method to 0 to enforce using the primal simplex, otherwise there might not be any feasible solutions until optimality.

    Did you try some parameter tuning to check whether your LP is really not solvable in an acceptable time frame?

    If you are only interested in a feasible solution, you may also ignore the objective function and solve the feasibility problem:

    f = model.feasibility()


  • Amin Ahmadi
    First Comment

    Thanks for your explanation. I have a general question. In my case, building the lp model is taking too much time ( more than 3000 seconds). I am seeking a way to generate the model in a short time. Do you have any suggestions to generate a model in a reasonable time?

  • Alison Cozad
    Gurobi Staff Gurobi Staff

    You can find some suggestions to speed up your model build here:  How do I speed up the time to build my model?


Please sign in to leave a comment.