Skip to main content

Save Julia Gurobi model and load and run with different datainputs

Ongoing

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three 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.
  • Jonasz Staszek
    • Community Moderator
    • Gurobi-versary
    • Thought Leader
    • First Question

    Hi Katinka,

    I'm no expert in Julia, but perhaps it is possible to export a module (in particular I mean to export the methods which you use to generate the model, then load them someplace else and use them with new data)?

    Best regards
    Jonasz

    1
  • Katinka Klepsch
    • Gurobi-versary
    • First Comment
    • First Question

    Thanks! That helps.

    However I cannot use the variable (eg x) in another fil when I try to use x. And I when I try to return x in my function in the module, it just returns the model instead. Do you know why? :-)

    include("01initial_model_module.jl")
    using JuMP
    using Gurobi

    using .model_module_test
    path_to_data = "data_final_v1.jl" # path to data
    model = deterministic_model_test(path_to_data)
    optimize!(model)
    if termination_status(model) == MOI.OPTIMAL
          xres=value.(x) ---> ERROR
    end
     
     
     
    0

Post is closed for comments.