BestSubsetProblem

class BestSubsetProblem(parameters: Parameters, numberOfTopics: Int, precomputedData: PrecomputedData, val topicLabels: Array<String>, legacyBoxedCorrelation: (DoubleArray, DoubleArray) -> Double, targetStrategy: (BinarySolution, Double) -> BinarySolution) : BinaryProblem

jMetal BinaryProblem implementation for the best subset selection task.

The problem receives a precomputed bundle of AP values per (system, topic) and evaluates binary masks over topics by computing a correlation between:

  • X: per-system means of AP over the currently selected topics (subset means).

  • Y: per-system full-set mean AP (precomputed once).

Correlation backend:

Performance considerations:

  • Uses incremental subset SUMS (DoubleArray) with an in-place diff update against the last evaluated mask or fixed‑K swap hints from BestSubsetSolution.

  • Per-thread DoubleArray buffers for X means are stored in a ThreadLocal to be parallel-safe and GC‑friendly.

  • The problem does not retain clones for streaming; writers/streaming are handled outside in the dataset layer.

Objective encoding is delegated via targetStrategy, which sets objectives in the underlying BestSubsetSolution according to the selected target (e.g., BEST/WORST).

Constructors

Link copied to clipboard
constructor(parameters: Parameters, numberOfTopics: Int, averagePrecisions: MutableMap<String, DoubleArray>, meanAveragePrecisions: DoubleArray, topicLabels: Array<String>, correlationStrategy: (DoubleArray, DoubleArray) -> Double, targetStrategy: (BinarySolution, Double) -> BinarySolution)

Secondary constructor kept for API compatibility with older boxed‑array call sites. It converts boxed AP rows to primitives and builds PrecomputedData internally.

constructor(parameters: Parameters, numberOfTopics: Int, precomputedData: PrecomputedData, topicLabels: Array<String>, legacyBoxedCorrelation: (DoubleArray, DoubleArray) -> Double, targetStrategy: (BinarySolution, Double) -> BinarySolution)

Properties

Link copied to clipboard
val dominatedSolutions: LinkedHashMap<Int, BinarySolution>

Dominated solutions per K (kept only for compatibility with existing writers).

Link copied to clipboard

Human-readable labels per topic, forwarded to solutions.

Link copied to clipboard
val topSolutions: LinkedHashMap<Int, MutableList<BinarySolution>>

Top solutions per K (public lists are preserved for writer compatibility).

Functions

Link copied to clipboard
open override fun createSolution(): BinarySolution

Creates a new solution:

Link copied to clipboard
open override fun evaluate(solution: BinarySolution): BinarySolution

Evaluates a solution by computing the natural correlation from the current subset and delegating objective encoding to targetStrategy.

Link copied to clipboard
open override fun name(): String

Problem name.

Link copied to clipboard
open override fun numberOfBitsPerVariable(): List<Int>

Bits per variable (single variable with numberOfTopics bits).

Link copied to clipboard
open override fun numberOfConstraints(): Int

No constraints.

Link copied to clipboard
open override fun numberOfObjectives(): Int

Two objectives (K and correlation with target-dependent signs).

Link copied to clipboard
open override fun numberOfVariables(): Int

Single binary variable (topic mask).

Link copied to clipboard
open override fun totalNumberOfBits(): Int

Total number of bits equals number of topics.