Module adaptive_selection

Module adaptive_selection 

Source
Expand description

Real-time adaptive algorithm selection system

This module implements an intelligent, self-adapting system that automatically selects and configures the optimal spatial algorithms based on real-time data characteristics, system performance metrics, and environmental conditions. It combines machine learning, heuristics, and performance feedback to make optimal algorithmic decisions.

§Features

  • Real-time algorithm selection: Choose optimal algorithms based on data patterns
  • Performance-based adaptation: Learn from execution performance to improve decisions
  • Multi-objective optimization: Balance accuracy, speed, memory usage, and energy
  • Dynamic parameter tuning: Automatically adjust algorithm parameters
  • Context-aware selection: Consider system load, hardware capabilities, user preferences
  • Predictive algorithm switching: Anticipate optimal algorithms for future data
  • Ensemble coordination: Intelligently combine multiple algorithms
  • Resource-aware scheduling: Optimize for available computational resources

§Selection Strategies

The system uses multiple strategies:

  • Pattern-based selection: Analyze data patterns to predict best algorithms
  • Performance history: Learn from past performance on similar datasets
  • Resource availability: Consider current CPU, memory, GPU availability
  • Quality requirements: Adapt to accuracy vs. speed trade-offs
  • Online learning: Continuously update selection models

§Examples

use scirs2_spatial::adaptive_selection::{AdaptiveAlgorithmSelector, SelectionContext};
use scirs2_core::ndarray::array;

// Create adaptive selector with multiple strategies
let mut selector = AdaptiveAlgorithmSelector::new()
    .with_performance_learning(true)
    .with_resource_awareness(true)
    .with_quality_optimization(true)
    .with_ensemble_methods(true);

// Define selection context
let context = SelectionContext::new()
    .with_accuracy_priority(0.8)
    .with_speed_priority(0.6)
    .with_memory_constraint(1_000_000_000) // 1GB limit
    .with_real_time_requirement(true);

let points = array![[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [1.0, 1.0]];

// Automatically select and configure optimal algorithm
let selection = selector.select_optimal_algorithm(&points.view(), &context).await?;
println!("Selected algorithm: {:?}", selection.algorithm);
println!("Configuration: {:?}", selection.parameters);
println!("Expected performance: {:?}", selection.performance_prediction);

// Execute with selected algorithm and provide feedback
let execution_result = selector.execute_with_feedback(&selection, &points.view()).await?;
println!("Actual performance: {:?}", execution_result.actual_performance);

Structs§

ActualPerformance
Actual performance measurement
AdaptiveAlgorithmSelector
Adaptive algorithm selector
AlgorithmEvaluation
Algorithm evaluation result
AlgorithmParameters
Algorithm parameters
AlgorithmResult
Algorithm execution result
AlgorithmSelection
Algorithm selection result
CacheKey
Cache key for selection caching
CachedSelection
Cached selection
ConfidenceIntervals
Confidence intervals for predictions
DataCharacteristics
Data characteristics for pattern matching
DataPattern
Data pattern for performance mapping
EnvironmentalConstraints
Environmental constraints for algorithm selection
ExecutionResult
Complete execution result with feedback
FeatureExtractor
Feature extractor for pattern analysis
GpuStatus
GPU status information
NetworkStatus
Network status information
PatternAnalyzer
Data pattern analyzer
PatternModel
Pattern recognition model
PerformanceHistory
Performance history tracking
PerformancePrediction
Performance prediction
PerformanceRecord
Individual performance record
PerformanceTrend
Performance trend analysis
QualityMeasurement
Quality measurement
QualityModel
Quality prediction model
QualityPredictor
Quality predictor for accuracy estimation
ResourceMonitor
Resource monitor for system awareness
SelectionCache
Selection cache for performance optimization
SelectionContext
Selection context for algorithm selection
SelectionReasoning
Selection reasoning

Enums§

ClusteringTendencyCategory
Clustering tendency categories
DensityCategory
Density categories
DimensionalityCategory
Dimensionality categories
DistributionType
Distribution type
NoiseLevel
Noise level categories
ParameterValue
Parameter value types
PatternModelType
Pattern model types
SelectedAlgorithm
Selected algorithm enumeration
SelectionStrategy
Selection strategy enumeration
SizeCategory
Data size categories
TrendDirection
Trend direction