Search code examples
or-toolscp-sat

Can I read the model file back from model.ExportToFile('test.pd.txt') in Or-Tools CP-SAT and solve it again for debug purpose


I have a file generated from model.ExportToFile('test.pd.txt') in ortools CP-SAT. can I read the txt file back and solve it again for debug purpose?

we can do this in other solvers like, cplex, gurobi. But i do know how to do it in OR-Tools CP-SAT.

read the model txt file directly and then solve it.


Solution

  • The binary sat_runner can load and run saved models.

    sat_runner --input proto_file --params params_in_text_format
    

    The source is in ortools/sat/sat_runner.cc

    See also this thread