Reorganize files

This commit is contained in:
2021-05-24 15:33:32 -05:00
parent 62974e2438
commit 6784b2153d
9 changed files with 37 additions and 35 deletions

View File

@@ -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
View 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

View File

@@ -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

View File

@@ -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