biogeme.tools.unique_ids module
- class biogeme.tools.unique_ids.ModelNames(prefix='Model')[source]
Bases:
object
Class generating model names from unique configuration string
- Parameters:
prefix (str)
- biogeme.tools.unique_ids.generate_unique_ids(list_of_ids)[source]
If there are duplicates in the list, a new list is generated where there are renamed to obtain a list with unique IDs.
- Parameters:
list_of_ids (list[str]) – list of ids
- Return type:
dict
[str
,str
]- Returns:
a dict that maps the unique names with the original name
- biogeme.tools.unique_ids.unique_product(*iterables, max_memory_mb=1024)[source]
Generate the Cartesian product of multiple iterables, keeping only the unique entries. Raises a MemoryError if memory usage exceeds the specified threshold.
- Parameters:
iterables (Iterable) – Variable number of iterables to compute the Cartesian product from.
max_memory_mb (int) – Maximum memory usage in megabytes (default: 1024MB).
- Returns:
Yields unique entries from the Cartesian product.
- Return type:
Iterator[tuple]