resolve_memory_mode: Resolve a requested memory_mode to a concrete decision

View source: R/matching_memory.R

resolve_memory_modeR Documentation

Resolve a requested memory_mode to a concrete decision

Description

Resolve a requested memory_mode to a concrete decision

Usage

resolve_memory_mode(
  n,
  m,
  memory_mode = c("auto", "dense", "lazy", "implicit"),
  solver_supports_lazy = FALSE,
  solver_supports_implicit = FALSE,
  ram_fraction = 0.5,
  fallback_threshold_mb = 4000
)

Arguments

n, m

Problem dimensions (left/right unit counts).

memory_mode

One of "auto" (probe RAM and decide), "dense" (always, skip probing entirely), "lazy" (always, error if unsupported here), or "implicit" (always, error if unsupported here).

solver_supports_lazy

Whether a lazy path actually exists for the caller's chosen solver/distance combination (TRUE only for method = "jv"/"auction" with a built-in distance metric, on a caller whose solve path consumes a lazy_cost_spec; see R/matching_lazy.R).

solver_supports_implicit

Whether the caller's design is the one the edge-generation loop solves: a 1:1 matching over a built-in distance metric, whose network is one unit-capacity bipartite block.

ram_fraction

Fraction of available RAM a dense solve's peak may reach before "auto" switches away from dense.

fallback_threshold_mb

Fixed threshold used when available RAM can't be determined (mirrors the warn+fallback precedent in R/morph_utils.R's matrix_size > 1e8 cell guard).

Value

"dense", "lazy" or "implicit".


couplr documentation built on Sept. 17, 2026, 1:08 a.m.