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 (note that these examples use add_single() rather than add()):

from ribs.archives import AddStatus
status, _ = archive.add_single(solution, objective, measures)
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_single(solution, objective, measures)
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

NOT_ADDED

IMPROVE_EXISTING

NEW