Skip to content

Optional "info" object for each entry #4

@nikohansen

Description

@nikohansen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions