CESampler

abstract class CESampler(val problemDefinition: ProblemDefinition, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = RNStreamProvider()) : MVSampleIfc, RNStreamControlIfc(source)

Abstract base class for the sampling mechanism (the "reference distribution") used by the Cross-Entropy method. Sub-classes implement the distribution-specific behavior: generating a sample (via MVSampleIfc), updating the parameters from an elite sample, and reporting convergence. The Cross-Entropy method permits different reference distributions; CENormalSampler is the multivariate-normal default and currently the only implementation.

A sampler is self-sufficient: by default it owns a fresh provider and a stream, so it can be exercised standalone (for example, in tests) without a CrossEntropySolver. When a sampler is handed to a solver, the solver adopts it onto the solver's own stream provider, on a stream distinct from the solver's base stream. That adoption is the single point at which the two providers become the same. The adoption is performed only by the owning solver (it is module-internal), so client code cannot reassign a sampler's stream and short-circuit the process.

Parameters

problemDefinition

the problem definition associated with the sampling process

streamNum

the stream number used while the sampler is standalone (unattached); 0 (the default) means the next available stream. It is superseded once the sampler is attached to a solver.

streamProvider

the provider used while the sampler is standalone; defaults to a fresh RNStreamProvider so the sampler has its own streams. It is replaced by the solver's provider on attachment.

Inheritors

Constructors

Link copied to clipboard
constructor(problemDefinition: ProblemDefinition, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = RNStreamProvider())

Properties

Link copied to clipboard

If true, the stream will automatically participate in having its stream advanced to the next sub-stream via stream managers

Link copied to clipboard
open override var antithetic: Boolean

Tells the stream to start producing antithetic variates

Link copied to clipboard
Link copied to clipboard
open override var resetStartStreamOption: Boolean

If true, the stream will automatically participate in having its stream reset to its start stream via stream managers

Link copied to clipboard

The random number stream used by the sampler. Initially drawn from the sampler's own provider; replaced with a distinct stream from the solver's provider when the sampler is attached.

Link copied to clipboard

The assigned stream number of the current stream within the current provider.

Link copied to clipboard

The stream provider currently backing this sampler. Initially the sampler's own provider; replaced by the owning solver's provider when the sampler is attached.

Functions

Link copied to clipboard
open override fun advanceToNextSubStream()

Positions the RNG at the beginning of its next substream

Link copied to clipboard
abstract fun hasConverged(): Boolean
Link copied to clipboard
abstract fun initializeParameters(values: DoubleArray)

Specifies the initial values of the underlying sampling mechanism.

Link copied to clipboard
abstract fun parameters(): DoubleArray
Link copied to clipboard
open override fun resetStartStream()

The resetStartStream method will position the RNG at the beginning of its stream. This is the same location in the stream as assigned when the RNG was created and initialized.

Link copied to clipboard
open override fun resetStartSubStream()

Resets the position of the RNG at the start of the current substream

Link copied to clipboard
abstract fun updateParameters(elites: List<DoubleArray>)

The underlying parameters of the sampling mechanism should be updated. Implementors need to handle the edge case of fewer than 2 elites.