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/exceptions.jl")
|
||||
include("modeling/jump_instance.jl")
|
||||
include("modeling/jump_solver.jl")
|
||||
include("modeling/learning_solver.jl")
|
||||
include("modeling/macros.jl")
|
||||
include("instance/jump.jl")
|
||||
include("solvers/jump.jl")
|
||||
include("solvers/learning.jl")
|
||||
include("solvers/macros.jl")
|
||||
|
||||
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
|
||||
|
||||
|
||||
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
|
||||
@@ -8,6 +8,6 @@ using MIPLearn
|
||||
MIPLearn.setup_logger()
|
||||
|
||||
@testset "MIPLearn" begin
|
||||
include("modeling/jump_solver_test.jl")
|
||||
include("modeling/learning_solver_test.jl")
|
||||
include("solvers/jump.jl")
|
||||
include("solvers/learning.jl")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user