Skip to content

Commit

Permalink
add lp writter option
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Sep 23, 2024
1 parent 8fed4e8 commit 2204b5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/operation/operation_model_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ function solve_impl!(model::OperationModel)
tss = replace("$(ts)", ":" => "_")
model_export_path = joinpath(model_output_dir, "exported_$(model_name)_$(tss).json")
serialize_optimization_model(container, model_export_path)
@debug write_lp_file(get_jump_model(container), replace(model_export_path, ".json" => ".lp"))
end

status = solve_impl!(container, get_system(model))
Expand Down
7 changes: 7 additions & 0 deletions src/utils/jump_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,13 @@ function serialize_jump_optimization_model(jump_model::JuMP.Model, save_path::St
return
end

function write_lp_file(jump_model::JuMP.Model, save_path::String)
MOF_model = MOPFM(; format = MOI.FileFormats.FORMAT_LP)
MOI.copy_to(MOF_model, JuMP.backend(jump_model))
MOI.write_to_file(MOF_model, save_path)
return
end

# check_conflict_status functions can't be tested on CI because free solvers don't support IIS
function check_conflict_status(
jump_model::JuMP.Model,
Expand Down

0 comments on commit 2204b5b

Please sign in to comment.