mirror of
https://github.com/ANL-CEEESA/MIPLearn.jl.git
synced 2025-12-06 08:28:52 -06:00
Store ML training data in a separate HDF5 file
This commit is contained in:
@@ -15,7 +15,7 @@ mutable struct FileInstance <: Instance
|
||||
function FileInstance(filename::AbstractString, build_model::Function)::FileInstance
|
||||
instance = new(nothing, nothing, filename, nothing, build_model)
|
||||
instance.py = PyFileInstance(instance)
|
||||
instance.h5 = Hdf5Sample(filename)
|
||||
instance.h5 = Hdf5Sample("$filename.h5", mode="a")
|
||||
instance.filename = filename
|
||||
return instance
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ using Cbc
|
||||
solver = LearningSolver(Cbc.Optimizer)
|
||||
solve!(solver, instance)
|
||||
|
||||
h5 = Hdf5Sample(filename)
|
||||
h5 = Hdf5Sample("$filename.h5")
|
||||
@test h5.get_scalar("mip_wallclock_time") > 0
|
||||
end
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ end
|
||||
instance = FileInstance(filename, build_model)
|
||||
solver = LearningSolver(Cbc.Optimizer)
|
||||
solve!(solver, instance)
|
||||
h5 = MIPLearn.Hdf5Sample(filename)
|
||||
h5 = MIPLearn.Hdf5Sample("$filename.h5")
|
||||
@test h5.get_array("mip_var_values") == [1.0, 0.0]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user