generate

open override fun generate(sortedData: DoubleArray, numGroups: Int, certificate: AdmissibilityCertificate): DataPartition?(source)

The optimal partition into the supplied number of groups subject to the certificate: cuts fall only at value-block boundaries, and every group meets the size and distinct-value requirements. Returns null when no such partition exists.

This is a separate dynamic program rather than a repair of the unconstrained one, because moving an unconstrained cut to the nearest admissible position does not in general yield the constrained optimum.

Parameters

sortedData

the observations in non-decreasing order

numGroups

the requested number of groups, must be positive

certificate

the structural constraints