ribs.archives.AddStatus

class ribs.archives.AddStatus(value)[source]

A status returned by the add() method in an archive.

This class is an IntEnum with the following values:

  • NOT_ADDED: The solution given to add() was not added to the archive.

  • IMPROVE_EXISTING: The solution given to add() improved an elite already in the archive.

  • NEW: The solution given to add() created a new elite in the archive.

Example

Check the status of an add operation as follows:

from ribs.archives import AddStatus
status, _ = archive.add(solution, objective_value, behavior_values)
if status == AddStatus.NEW:
    # Do something if the solution made a new elite in the archive.

To check whether the solution was added to the archive, the status can act like a bool:

from ribs.archives import AddStatus
status, _ = archive.add(solution, objective_value, behavior_values)
if status:
    # Do something if the solution was added to the archive.

Finally, there is an ordering on statuses:

AddStatus.NEW > AddStatus.IMPROVE_EXISTING > AddStatus.NOT_ADDED

Attributes

IMPROVE_EXISTING

NEW

NOT_ADDED