Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional "info" object for each entry #4

Open
nikohansen opened this issue May 19, 2021 · 2 comments
Open

Optional "info" object for each entry #4

nikohansen opened this issue May 19, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@nikohansen
Copy link
Contributor

nikohansen commented May 19, 2021

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

  • add and _add_at
  • remove

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.

@nikohansen nikohansen added the enhancement New feature or request label May 19, 2021
@naceee
Copy link

naceee commented Sep 2, 2024

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
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants