RmdSampler

class RmdSampler(val problemDefinition: ProblemDefinition, val rnStream: RNStreamIfc, val defaultWarmUp: Int = DEFAULT_WARM_UP)(source)

A coordinate-direction (RMD — random multidimensional) sampler that draws points approximately uniformly from a MostPromisingArea. Starting from a point known to lie in the MPA, the sampler repeatedly picks a random coordinate and resamples that coordinate from its feasible interval, holding the others fixed — a Gibbs-style walk over the polytope. After a warm-up of such moves the current point is returned.

The feasible interval for the chosen axis is the intersection of:

  • the box bounds [lower_j, upper_j] from the problem, and

  • the per-axis bound implied by every half-space a · x <= b in the MPA (the original linear constraints and the active halfway hyperplanes), holding the other coordinates fixed.

When the input has positive granularity the axis is resampled on its integer grid lower_j + m * g_j; with zero granularity it is resampled continuously. After each proposed move the full point is checked with ProblemDefinition.isInputFeasible so that functional constraints not expressible as half-spaces are respected: an infeasible proposal is rejected and the walk stays at the current value for that step. A run is reproducible for a fixed rnStream.

Parameters

problemDefinition

the problem supplying box bounds, granularities, and the feasibility test

rnStream

the random stream driving axis selection and resampling

defaultWarmUp

the default number of coordinate moves per sample call

Constructors

Link copied to clipboard
constructor(problemDefinition: ProblemDefinition, rnStream: RNStreamIfc, defaultWarmUp: Int = DEFAULT_WARM_UP)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun sample(mpa: MostPromisingArea, start: DoubleArray, halfSpaces: List<HalfSpace> = mpa.allHalfSpaces, warmUp: Int = defaultWarmUp): DoubleArray

Draws a point from mpa by running a coordinate-direction walk for warmUp moves beginning at start. start must already lie in the MPA; the returned point also lies in the MPA. The walk uses halfSpaces for the per-axis interval — pass the MPA's active half-spaces to skip redundant ones, or MostPromisingArea.allHalfSpaces for the unpruned set.