QDpy
Loading...
Searching...
No Matches
density_flow.py File Reference

Rank Density Descent Search candidates with a continuous normalizing flow. More...

Go to the source code of this file.

Classes

class  qdpy.algorithms.density_flow.DDSCNFResult
 DDS accounting with separate model training and density prediction counts. More...
class  qdpy.algorithms.density_flow._FlowDensity

Namespaces

namespace  qdpy

Functions

 qdpy.algorithms.density_flow._log_density (torch, network, points, integration_steps)
 qdpy.algorithms.density_flow.dds_cnf (archive, evaluate, *, x0, budget, reservoir_size=1024, sigma0=.15, batch_size=16, ind_domain=(0., 1.), seed=0, executor=None, on_step=None, model_width=32, fit_period=4, fit_steps=20, fit_batch_size=32, integration_steps=8, learning_rate=.003)
 Use a flow-matched continuous density in the standard CMA-based DDS loop.

Detailed Description

Rank Density Descent Search candidates with a continuous normalizing flow.

See also
https://doi.org/10.1145/3638529.3654001

Definition in file density_flow.py.

Function Documentation

◆ _log_density()

qdpy.algorithms.density_flow._log_density ( torch,
network,
points,
integration_steps )
protected
Integrate descriptors and the exact change-of-variables trace backward.

Definition at line 32 of file density_flow.py.

◆ dds_cnf()

qdpy.algorithms.density_flow.dds_cnf ( archive,
evaluate,
* ,
x0,
budget,
reservoir_size = 1024,
sigma0 = .15,
batch_size = 16,
ind_domain = (0., 1.),
seed = 0,
executor = None,
on_step = None,
model_width = 32,
fit_period = 4,
fit_steps = 20,
fit_batch_size = 32,
integration_steps = 8,
learning_rate = .003 )

Use a flow-matched continuous density in the standard CMA-based DDS loop.

Parameters
archiveEmpty parentless best-only Grid or CVTGrid used for reporting.
evaluateCallable (genome) returning singleton fitness and a descriptor vector.
x0Initial CMA mean.
budgetTotal attempted evaluations, including failures.
reservoir_sizeNumber of previous measurements retained for the density model.
sigma0CMA sampling scale.
batch_sizeCandidate batch size.
ind_domainShared genome bounds, or None for unbounded search.
seedPrivate search and flow seed.
executorOptional ordered map executor for evaluations.
on_stepOptional callback receiving archive, iteration, and evaluation count.
model_widthWidth of the two hidden layers.
fit_periodBatches between model updates.
fit_stepsAdam updates at each refit.
fit_batch_sizeDescriptor samples per Adam update.
integration_stepsMidpoint integration steps per density calculation.
learning_rateFlow Adam learning rate.
Returns
DDSCNFResult with separate search, training, and prediction accounting.
Run DDS with a CPU PyTorch flow trained by conditional flow matching.

Fit only on earlier descriptor batches. Score a candidate by mapping its
descriptor back to a standard Gaussian and integrating the velocity
divergence. A fixed affine normalization is learned from the first
nonempty reservoir. Its log determinant cancels in the ranking.
Fitness still controls only admission to the reporting archive.

Requires pycma and PyTorch, available through the existing ``dms`` extra.

Definition at line 153 of file density_flow.py.