Skip to main content

solution file and rew as input

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Gurobot (AI-generated response)
    • Gurobi Staff

    To share an obfuscated MPS file and a compatible warm-start solution file with Gurobi support:

    1. Obfuscate MPS File: Replace column and row names in the MPS file with generic identifiers (e.g., COL001, ROW001).

    2. Update Solution File: Modify the .sol file to match the new names in the obfuscated MPS file.

    3. Check Consistency: Ensure the obfuscated MPS and updated solution file are consistent by loading them in Gurobi.

    4. Share with Support: Send the consistent obfuscated MPS and solution files to Gurobi support, explaining the obfuscation for context.

    0
  • Ahmed Azab
    • Gurobi Staff

    Hi Matthew,

    The following Python code can also do what you are looking for.

    import gurobipy as gp

    m1 = gp.read("test.mps")
    m1.read("test.sol")
    m1.params.SolutionLimit=1
    m1.optimize()
    m1.write("test.rew")

    m2= gp.read("test.rew")
    A = m2.getAttr("VarName", m2.getVars()) #Get variables names from rew file

    m1.setAttr("VarName", m1.getVars(), A) #Replace variable names in m1 with names from rew
    m1.write("test1.sol")

    The variables names in test1.sol should match the names in the rew file 

    I hope this can help

     

    Thanks 

    - Ahmed

    0

Post is closed for comments.