Coluna.jl icon indicating copy to clipboard operation
Coluna.jl copied to clipboard

Names for Data/Storage/StorageState

Open guimarqu opened this issue 5 years ago • 7 comments

I don't understand how you can restore the state of an empty storage ? The state should be empty ? Maybe we should rename AbstractStorageState to AbstractDataState because it's the state of the AbstractData ?

Originally posted by @guimarqu in https://github.com/atoptima/Coluna.jl/pull/323

waiting to get some ideas.


EDIT (2021/03/01), 2nd EDIT (2021/03/18):

Todo:

  • [x] StorageState becomes Record
  • [x] Storage becomes (Storage)Unit
  • [x] change order of arguments in restore_from_record!
  • [x] StorageContainer becomes StorageUnitWrapper
  • [x] move storage into ColunaBase
  • [x] move StorageDict into Model, then delete AbstractData (new method in model interface)
  • [x] StorageDict becomes Storage
  • [ ] unit tests on storage "public" methods

Decisions to make :

  • [ ] method to instanciate records ? https://github.com/atoptima/Coluna.jl/pull/470#discussion_r596941248
  • [ ] method to instanciate units ?
  • [ ] remove NOT_USED (because NOT_USED and READ_ONLY are the same) (@rrsadykov)

Improve dev Exp :

  • [ ] RecordsVector -> Vector{Record}
  • [x] StorageDict ? -> Storage
  • [x] UnitTypePair = Pair{DataType, DataType} ? -> removed because now bijection between UnitType & RecordType
  • [x] UnitsUsageDict = Dict{Tuple{AbstractModel, UnitTypePair}, UnitAccessMode} ? -> UnitsUsage

Conversations to resolve :

  • [ ] https://github.com/atoptima/Coluna.jl/pull/471#discussion_r597499436
  • [ ] https://github.com/atoptima/Coluna.jl/pull/472#discussion_r597623524
  • [ ] https://github.com/atoptima/Coluna.jl/pull/518#discussion_r620311675

Variables to rename :

  • [ ] storage / storage unit wrapper in storages.jl
  • [ ] storagedict / storage

Needs documentation (or remove)

  • [ ] initialize_storage_units
  • [ ] collect_units_to_restore! (why a UnitsUsageDict as first arg ?)
  • [ ] store_records(reform)
  • [ ] store_records(reform, record_vector)
  • [ ] getstorageunit(model, storage_unit_type)
  • [ ] record_type

guimarqu avatar May 02 '20 16:05 guimarqu

We can rename EmptyStorage to FormulationStorage. Renaming AbstractStorageState to AbstractDataState is ok for me. I would also be good to rename RuntimeData (ColGenRuntimeData, TreeSearchRuntimeData, etc) to something else, as now there are two datas in the the algorithms (runtime data and reformulation data). This is not good for the code readability.

rrsadykov avatar May 04 '20 14:05 rrsadykov

It would be nice if we could remove RunTimeData structures in the long run.

guimarqu avatar May 12 '20 09:05 guimarqu

We need this kind of structure to keep the intermediate data which is needed only during the run of the algorithm

rrsadykov avatar May 12 '20 10:05 rrsadykov

If you look at column generation, the structure is useless. We use it because we didn't think carefuly about the code design.

guimarqu avatar May 12 '20 11:05 guimarqu

I agree that in column generation is not that useful. However, for example, in the tree search algorithm we need to store the tree somewhere.

rrsadykov avatar May 12 '20 11:05 rrsadykov

Todo (cc @rrsadykov) :

Edit : move the list of tasks to do in top comment.

guimarqu avatar Mar 01 '21 22:03 guimarqu

Review

  • https://github.com/atoptima/Coluna.jl/blob/d6ef18127dc900987af0acee10fffd5bbc8aab1b/src/Algorithm/formstorages.jl#L12 (not in the interface)

Public

https://github.com/atoptima/Coluna.jl/blob/d6ef18127dc900987af0acee10fffd5bbc8aab1b/src/Algorithm/storage.jl#L329-L359

https://github.com/atoptima/Coluna.jl/blob/d6ef18127dc900987af0acee10fffd5bbc8aab1b/src/Algorithm/storage.jl#L22-L28

When you create a record vector with copy or store, you then must destruct records using restore or remove. Otherwise memory leaks.

Dev

  • Create a unit storage <:AbstractUnitStorage
  • Define 0 to n record(s) for this unit storage
  • Define Pair : Type{<:Unit} => Type{<:Record} (if no record : use EmptyRecord)
  • Define constructor for the abstract unit storage : https://github.com/atoptima/Coluna.jl/blob/d6ef18127dc900987af0acee10fffd5bbc8aab1b/src/Algorithm/storage.jl#L41-L44
  • Define constructor for the record : https://github.com/atoptima/Coluna.jl/blob/d6ef18127dc900987af0acee10fffd5bbc8aab1b/src/Algorithm/storage.jl#L54-L56
  • Define https://github.com/atoptima/Coluna.jl/blob/d6ef18127dc900987af0acee10fffd5bbc8aab1b/src/Algorithm/storage.jl#L60-L66

guimarqu avatar Mar 25 '21 11:03 guimarqu