mirror of
https://github.com/ANL-CEEESA/MIPLearn.jl.git
synced 2025-12-06 08:28:52 -06:00
Reorganize files
This commit is contained in:
@@ -16,9 +16,9 @@ miplearn = pyimport("miplearn")
|
|||||||
|
|
||||||
include("utils/log.jl")
|
include("utils/log.jl")
|
||||||
include("utils/exceptions.jl")
|
include("utils/exceptions.jl")
|
||||||
include("modeling/jump_instance.jl")
|
include("instance/jump.jl")
|
||||||
include("modeling/jump_solver.jl")
|
include("solvers/jump.jl")
|
||||||
include("modeling/learning_solver.jl")
|
include("solvers/learning.jl")
|
||||||
include("modeling/macros.jl")
|
include("solvers/macros.jl")
|
||||||
|
|
||||||
end # module
|
end # module
|
||||||
|
|||||||
31
src/instance/file.jl
Normal file
31
src/instance/file.jl
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# MIPLearn: Extensible Framework for Learning-Enhanced Mixed-Integer Optimization
|
||||||
|
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
struct FileInstance
|
||||||
|
filename::AbstractString
|
||||||
|
loaded::Union{Nothing,JuMPInstance}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function FileInstance(filename::AbstractString)::FileInstance
|
||||||
|
return FileInstance(
|
||||||
|
filename,
|
||||||
|
nothing,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function load!(instance::FileInstance)
|
||||||
|
instance.loaded = load_jump_instance(instance.filename)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function free!(instance::FileInstance)
|
||||||
|
instance.loaded = nothing
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function flush!(instance::FileInstance)
|
||||||
|
save(instance.filename, instance.loaded)
|
||||||
|
end
|
||||||
@@ -140,33 +140,4 @@ function load_jump_instance(filename::AbstractString)::JuMPInstance
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
struct FileInstance
|
|
||||||
filename::AbstractString
|
|
||||||
loaded::Union{Nothing,JuMPInstance}
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function FileInstance(filename::AbstractString)::FileInstance
|
|
||||||
return FileInstance(
|
|
||||||
filename,
|
|
||||||
nothing,
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function load!(instance::FileInstance)
|
|
||||||
instance.loaded = load_jump_instance(instance.filename)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function free!(instance::FileInstance)
|
|
||||||
instance.loaded = nothing
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function flush!(instance::FileInstance)
|
|
||||||
save(instance.filename, instance.loaded)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
export JuMPInstance, save, load_jump_instance
|
export JuMPInstance, save, load_jump_instance
|
||||||
@@ -8,6 +8,6 @@ using MIPLearn
|
|||||||
MIPLearn.setup_logger()
|
MIPLearn.setup_logger()
|
||||||
|
|
||||||
@testset "MIPLearn" begin
|
@testset "MIPLearn" begin
|
||||||
include("modeling/jump_solver_test.jl")
|
include("solvers/jump.jl")
|
||||||
include("modeling/learning_solver_test.jl")
|
include("solvers/learning.jl")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user