Skip to main content

How to show model equation from .mps file to Jupyter notebook?

Answered

Comments

2 comments

  • Eli Towle
    Gurobi Staff Gurobi Staff

    Gurobi's read() function reads the model file into a Model object. To print the content of a model file, use Python's built-in open() function:

    with open("Outputs/model_v1.mps", "r") as f:
    contents = f.read()

    print(contents)

    Write the model to the LP (or RLP) format if you want it to be human-readable.

    1
  • TANMOY DAS
    Curious
    Conversationalist

    thanks so much. It works. 

    0

Please sign in to leave a comment.