CMA-ES / moarchiving

A bi-objective nondominated archive class
Other
2 stars 3 forks source link

Optional "info" object for each entry #4

Open nikohansen opened 3 years ago

nikohansen commented 3 years ago

It would be quite practical to have the option to maintain an "additional information" list where, for example, the user could store the respective solutions.

nda = moarchiving.BiobjectiveNondominatedSortedList()
nda.add(fun2(x), info=x)
nda.add(fun2(xa), info={'x': xa, 'note': 'xa seems to rock'})
nda.add(fun2(xb))
assert nda.info is None or len(nda) == len(nda.info)
print(nda.info)  # nda has an info property
[[0, 1, 2], {'x': [1, 2, 3], 'note': 'xa seems to rock'}, None]

Methods that need to be modified are

The list can be created only when an optional info argument is used for the first time to avoid always maintaining an info list of None elements.

naceee commented 4 days ago

Do you think it could be useful to also have the possibility to add a list of infos together with the list of f values when initializing the object? In 3 dimensions for example, adding points to the archive at initialization is much faster than adding them separately after.

nikohansen commented 4 days ago

Do you think it could be useful to also have the possibility to add a list of infos together with the list of f values when initializing the object?

Makes perfectly sense to me.