moocore.

BaseUnboundedArchive#

class moocore.BaseUnboundedArchive(dim, maximise)[source]#

Interface implemented by objects returned by UnboundedArchive().

This class defines the common interface for BaseUnboundedArchive objects. It is not intended to be instantiated directly. See Examples in UnboundedArchive().

__iter__()[source]#

Return z vectors and, if available, their associated x object one at a time.

For efficiency, iterating does not make copies of the vectors nor the objects. However, the vectors are marked as read-only, thus modifying them requires that the user makes a copy.

Modifying the archive while iterating raises a RuntimeError.

Return type:

Iterator[tuple[ndarray, Any]]

__len__()[source]#

Return the total number of points stored in the archive (including duplicates).

Return type:

int

add(z, x=None)[source]#

Add a point if it is not (weakly-)dominated by the archive.

Points dominated by the added point are discarded. With allow_duplicates=True, weakly-dominated points are accepted. Otherwise, they are rejected.

Returns:

bool – True if added or False if rejected.

add_many(z, x=None)[source]#

Add several points sequentially and return acceptance as a boolean list.

Return type:

list[bool]

property dim#

Return the dimension of the points (objective vectors) stored in the archive.

dominated_by(z)[source]#

Return true if all points in the archive are dominated by z.

Return type:

bool

dominates(z)[source]#

Return true if a point in the archive dominates z.

Return type:

bool

get_contents()[source]#

Return the full contents of the archive.

Returns:

tuple[ndarray, list[Any] | None] – Tuple of objective vectors (as a Numpy array) and a list of x values (or None if not self.has_x_values())

get_unique_vectors()[source]#

Return the unique objective vectors stored in the archive.

Return type:

ndarray

get_x_values()[source]#

Return the x-values stored in the archive.

Return type:

list[Any]

get_x_values_of_vector(z)[source]#

Return the x-values of vector z.

Returns:

list[Any] – A list of objects or an empty list if there are none or z is not in the archive.

has_x_values()[source]#

Return true if the archive stores ‘x’ values.

Return type:

bool

unique_len()[source]#

Return the unique number of points stored in the archive.

Return type:

int