Python shortcuts for constructing and running common QD searches.
More...
Go to the source code of this file.
|
| RandomSearchMutPolyBounded | qdpy.simple.map_elites (*, int dimension, int budget, int|Sequence[int] shape, Sequence[DomainLike] fitness_domain, Sequence[DomainLike] features_domain, DomainLike ind_domain=(0, 1), int batch_size=1, str|Sequence[float] optimisation_task="minimisation") |
| | Construct a polynomial-mutation search with one elite per grid cell.
|
| RandomSearchMutPolyBounded | qdpy.simple.nslc (*, int dimension, int budget, Sequence[DomainLike] fitness_domain, Sequence[DomainLike] features_domain, float threshold_novelty, int k=15, DomainLike ind_domain=(0, 1), int batch_size=1, str|Sequence[float] optimisation_task="minimisation") |
| | Construct a novelty and local competition search with parent history.
|
| | qdpy.simple._reserve_manifest (str|PathLike[str]|None output_dir) |
| RunResult | qdpy.simple.run (QDAlgorithmLike algorithm, Callable evaluate, *, int|None seed=None, str|None backend=None, ExecutorLike|None executor=None, int|None max_workers=None, str|None ray_address=None, bool batch_mode=True, int|None pack_size=None, str|PathLike[str]|None output_dir=None, Mapping[str, Any]|None configuration=None, RunBundleOptions|None bundle=None) |
| | Run a native optimiser and optionally save its manifest.
|
Python shortcuts for constructing and running common QD searches.
Definition in file simple.py.
◆ _reserve_manifest()
| qdpy.simple._reserve_manifest |
( |
str | PathLike[str] | None | output_dir | ) |
|
|
protected |
Give one run exclusive use of its output directory until it finishes.
Definition at line 167 of file simple.py.
◆ map_elites()
| RandomSearchMutPolyBounded qdpy.simple.map_elites |
( |
* | , |
|
|
int | dimension, |
|
|
int | budget, |
|
|
int | Sequence[int] | shape, |
|
|
Sequence[DomainLike] | fitness_domain, |
|
|
Sequence[DomainLike] | features_domain, |
|
|
DomainLike | ind_domain = (0, 1), |
|
|
int | batch_size = 1, |
|
|
str | Sequence[float] | optimisation_task = "minimisation" ) |
Construct a polynomial-mutation search with one elite per grid cell.
Make a MAP-Elites search for real-valued genomes.
:param dimension: Number of coordinates in each genome.
:param budget: Number of candidate evaluations per run.
:param shape: Number of bins for each descriptor, or an integer for one descriptor.
:param fitness_domain: One closed interval per objective.
:param features_domain: One closed interval per grid axis.
:param ind_domain: Bounds shared by all genome coordinates.
:param batch_size: Candidate count per batch. The default gives each proposal
feedback from the previous evaluation.
:param optimisation_task: Objective direction or a sequence of objective weights.
:returns: An optimiser ready for :func:`run` or the native ask/tell API.
Definition at line 60 of file simple.py.
◆ nslc()
| RandomSearchMutPolyBounded qdpy.simple.nslc |
( |
* | , |
|
|
int | dimension, |
|
|
int | budget, |
|
|
Sequence[DomainLike] | fitness_domain, |
|
|
Sequence[DomainLike] | features_domain, |
|
|
float | threshold_novelty, |
|
|
int | k = 15, |
|
|
DomainLike | ind_domain = (0, 1), |
|
|
int | batch_size = 1, |
|
|
str | Sequence[float] | optimisation_task = "minimisation" ) |
Construct a novelty and local competition search with parent history.
Make an NSLC search with a fixed novelty threshold.
The child archive uses Euclidean distances to its parent history. The
optimiser keeps that parent when saved with the native pickle tools.
:param dimension: Number of coordinates in each genome.
:param budget: Number of candidate evaluations per run.
:param fitness_domain: One closed interval per objective.
:param features_domain: One closed interval per descriptor.
:param threshold_novelty: Finite, nonnegative threshold in descriptor units.
:param k: Number of nearest neighbours to consider.
:param ind_domain: Bounds shared by all genome coordinates.
:param batch_size: Candidate count per batch.
:param optimisation_task: Objective direction or a sequence of objective weights.
:returns: An optimiser with a child novelty archive and a separate parent.
Definition at line 99 of file simple.py.
◆ run()
| RunResult qdpy.simple.run |
( |
QDAlgorithmLike | algorithm, |
|
|
Callable | evaluate, |
|
|
* | , |
|
|
int | None | seed = None, |
|
|
str | None | backend = None, |
|
|
ExecutorLike | None | executor = None, |
|
|
int | None | max_workers = None, |
|
|
str | None | ray_address = None, |
|
|
bool | batch_mode = True, |
|
|
int | None | pack_size = None, |
|
|
str | PathLike[str] | None | output_dir = None, |
|
|
Mapping[str, Any] | None | configuration = None, |
|
|
RunBundleOptions | None | bundle = None ) |
Run a native optimiser and optionally save its manifest.
Drive an existing optimiser with its native evaluation contract.
The optimiser keeps its archive, counters and callbacks between calls.
Evaluator results and failures follow the algorithm's ``optimise()``
behavior. Parallel feedback follows the executor's completion order.
:param algorithm: An optimiser with the native ``optimise()`` interface.
:param evaluate: Candidate evaluator, or a list-taking evaluator with ``pack_size``.
:param seed: Optional seed for the calling process's Python and NumPy global
random streams. Their states are restored after the run.
:param backend: Backend accepted by the parallelism manager. Defaults to sequential.
:param executor: A caller-owned executor. Use it on its own or select a managed backend.
:param max_workers: Worker limit passed to the parallelism manager.
:param ray_address: Address passed to the optional Ray backend.
:param batch_mode: Complete each batch before proposing the next one.
:param pack_size: Maximum number of candidates passed to a packed evaluator.
:param output_dir: Optional directory for a new ``run.json`` and supported grid export.
:param configuration: Run settings to record in the manifest. The actual
seed passed to the runner is recorded under ``seed``.
:param bundle: Optional portable history, lineage, and checkpoint settings.
Supply ``output_dir``. Checkpointed bundles use the native batch
driver with a sequential scalar evaluator or one packed call per batch.
:returns: References to the live run objects and the evaluation count for this call.
:raises FileExistsError: If the directory already has a manifest or an active run.
Definition at line 190 of file simple.py.