sample

negmas.helpers.sample(n, k, grid=False, compact=True, endpoints=True)[source]

Samples k items from n in the range (0, n-1) optionally explring them

Parameters
  • n – The number of items to sample (assumed to range from index 0 to n-1)

  • k – The number of samples to take

  • grid – Sample on a grid (equally distanced as much as possible)

  • compact – If True, the samples will be choosen near each other (see endpoints though)

  • endpoints – If given, the first and last index are guaranteed to be in the samples