Skip to main content

solution file and rew as input

Answered

Comments

2 comments

  • Gurobot (AI-generated response)
    Gurobi Staff 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 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

Please sign in to leave a comment.