View Source CEM.Sample (cem v0.1.1)

Module for generating a sample of instance-score pairs from the instance-generating probability distribution.

Summary

Functions

Given parameters of the instance-generating probability distribution, generate the elite sample of instances and the smallest (maximization problem) or largest (minimization problem) score of that sample.

Reduce a stream of instance-score pairs into the elite sample and the score associated with that sample.

Return a stream of instance-score pairs.

Types

@type draw_fn() :: (params() -> instance())
@type instance() :: any()
@type opts() :: map()
@type params() :: any()
@type score() :: float()
@type score_fn() :: (instance() -> score())
@type step() :: non_neg_integer()

Functions

Link to this function

generate_elite_sample_and_score(params, draw_fn, score_instnace_fn, opts)

View Source
@spec generate_elite_sample_and_score(params(), draw_fn(), score_fn(), opts()) ::
  {[instance()], score()}

Given parameters of the instance-generating probability distribution, generate the elite sample of instances and the smallest (maximization problem) or largest (minimization problem) score of that sample.

Link to this function

reduce_to_elite_sample_and_score(sample_stream, opts)

View Source
@spec reduce_to_elite_sample_and_score(Enumerable.t(), opts()) ::
  {[instance()], score()}

Reduce a stream of instance-score pairs into the elite sample and the score associated with that sample.

Link to this function

stream_instances_and_scores(params, draw_fn, score_fn)

View Source
@spec stream_instances_and_scores(params(), draw_fn(), score_fn()) :: Enumerable.t()

Return a stream of instance-score pairs.