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 toadd()
was not added to the archive.IMPROVE_EXISTING
: The solution given toadd()
improved an elite already in the archive.NEW
: The solution given toadd()
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 thanadd()
):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