boofun.core.batch_processing
Comprehensive batch processing infrastructure for Boolean function operations.
This module provides efficient batch evaluation, vectorized operations, and parallel processing capabilities for Boolean functions across all representations.
Functions
Get batch processing statistics and capabilities. |
|
|
Process a batch of inputs efficiently. |
|
Set thresholds for batch processing strategies. |
Classes
Abstract base class for batch processing strategies. |
|
Manages batch processing strategies for different representations. |
|
|
Optimized batch processor for ANF representations. |
|
Optimized batch processor for Fourier expansion representations. |
|
Optimized batch processor for truth table representations. |
|
Parallel batch processor using multiprocessing. |
|
Vectorized batch processor using NumPy operations. |
- class boofun.core.batch_processing.BatchProcessor[source]
Abstract base class for batch processing strategies.
- class boofun.core.batch_processing.VectorizedBatchProcessor(chunk_size: int = 10000)[source]
Vectorized batch processor using NumPy operations.
Optimized for representations that can leverage NumPy’s vectorization.
- __init__(chunk_size: int = 10000)[source]
Initialize vectorized processor.
- Parameters:
chunk_size – Size of chunks for memory-efficient processing
- class boofun.core.batch_processing.ParallelBatchProcessor(n_workers: int | None = None, use_processes: bool = True)[source]
Parallel batch processor using multiprocessing.
Distributes work across multiple CPU cores for compute-intensive operations.
- __init__(n_workers: int | None = None, use_processes: bool = True)[source]
Initialize parallel processor.
- Parameters:
n_workers – Number of worker processes/threads (default: CPU count)
use_processes – Whether to use processes (True) or threads (False)
- class boofun.core.batch_processing.OptimizedTruthTableProcessor(chunk_size: int = 100000)[source]
Optimized batch processor for truth table representations.
- class boofun.core.batch_processing.OptimizedFourierProcessor(chunk_size: int = 50000)[source]
Optimized batch processor for Fourier expansion representations.
- class boofun.core.batch_processing.OptimizedANFProcessor(chunk_size: int = 50000)[source]
Optimized batch processor for ANF representations.
- class boofun.core.batch_processing.BatchProcessorManager[source]
Manages batch processing strategies for different representations.
Automatically selects the best processor based on representation type, input size, and available hardware.
- process_batch(inputs: ndarray, function_data: Any, representation: str, space: Space, n_vars: int) ndarray[source]
Process batch using optimal strategy.
- Parameters:
inputs – Batch of inputs to process
function_data – Representation-specific function data
representation – Representation type
space – Mathematical space
n_vars – Number of variables
- Returns:
Batch evaluation results
- boofun.core.batch_processing.process_batch(inputs: ndarray, function_data: Any, representation: str, space: Space, n_vars: int) ndarray[source]
Process a batch of inputs efficiently.
- Parameters:
inputs – Batch of inputs
function_data – Representation-specific data
representation – Representation type
space – Mathematical space
n_vars – Number of variables
- Returns:
Batch evaluation results
- boofun.core.batch_processing.get_batch_processor_stats() Dict[str, Any][source]
Get batch processing statistics and capabilities.
- boofun.core.batch_processing.set_batch_thresholds(vectorized_threshold: int = 1000, parallel_threshold: int = 10000)[source]
Set thresholds for batch processing strategies.
- Parameters:
vectorized_threshold – Minimum size for vectorized processing
parallel_threshold – Minimum size for parallel processing