Skip to content

Scheduling Library#

The capturegraph.scheduling module provides the Void & Cluster importance sampling algorithm for selecting optimal capture times that maximize diversity across multiple dimensions.

Overview#

The scheduling library handles when to prompt users to capture data:

Procedure DSL → __notification__ hook → Scheduling Library → User Prompt

Key features:

  • Void & Cluster importance sampling for optimal coverage
  • Forecast utilities for generating candidate sessions
  • Distance functions for measuring session similarity
  • Assignment tracking to prevent duplicate notifications

Quick Start#

from datetime import timedelta
import capturegraph.data as cg
import capturegraph.scheduling as cgsh

# 1. Create potential sessions from time slots
potential = cg.List()
potential.date = cgsh.forecast.times(span=timedelta(hours=24))
potential.location = location  # scalar broadcast

# 2. Add solar angles (element-wise broadcasting)
potential.solar_angle = cgsh.forecast.solar_position(location, potential.date)

# 3. Define statistical distance using combine()
distance_fn = cgsh.distance.combine(
    solar_angle=cgsh.distance.solar(sigma_deg=2.0),
)

# 4. Select diverse sessions
selected = cgsh.select_sessions(
    potential,
    existing_sessions,
    distance_fn,
    energy_fn=cgsh.energy.gaussian(sigma=1.0),
    selections=10,
)

Section Contents#

Track user assignments and prevent duplicate prompts

The importance sampling algorithm for scheduling captures

Define metrics for measuring similarity between sessions