Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to print a model to file with JuMP/Julia

The function print(model) outputs the model in the console. How can I print the model in a file (e.g. lp file) ?

Best

Michael.

like image 914
Michael Avatar asked Sep 04 '25 17:09

Michael


1 Answers

Thank's ! This works:

f = open("model.lp", "w")
print(f, model)
close(f)

# Using `do` one doesn't have to remember to call `close(f)`
open("model.lp", "w") do f
    print(f, model)
end
like image 183
Michael Avatar answered Sep 07 '25 18:09

Michael