R/slct_less_used.R

Defines functions evict.evt_least_used evt_least_used

Documented in evt_least_used

#' @title Least used evictor
#' @description Used as the concept pool's `model_deleter`: returns the slot of the stored concept
#'  that was active for the fewest batches (`qty`).
#' @return A `evt_least_used` object.
#' @export
evt_least_used <- function() {
  obj <- evictor()
  class(obj) <- append("evt_least_used", class(obj))
  obj
}

#' @export
evict.evt_least_used <- function(obj, concept_list) {
  qtys <- vapply(concept_list, function(cn) cn$qty, numeric(1))
  used <- which(qtys > 0)
  used[which.min(qtys[used])]
}

Try the heimdall package in your browser

Any scripts or data that you put into this service are public.

heimdall documentation built on Dec. 2, 2026, 5:08 p.m.