Skip to main content

Crate temporal_control

Crate temporal_control 

Source
Expand description

§Temporal control

Simple temporal networks with uncertainty: dynamic controllability checking and dispatchable execution for no_std targets.

§Scope

  • Simple Temporal Networks (Stn): consistency checking with a negative-cycle explanation, minimal networks (all pairs, or the constrained pairs only with P³C), incremental consistency (IncrementalStn) and filtered dispatchable networks (Stn::dispatchable).
  • STNs with Uncertainty (Stnu): dynamic controllability by independent checkers (Stnu::dispatchable, which also yields an extended dispatchable network with waits; Stnu::check_controllability, Morris’s O(n^3) algorithm; and the others in DcAlgorithm). A negative verdict carries a SemiReducibleCycle naming the requirements and contingent extremes that conflict.
  • An onboard Dispatcher with fixed capacity that needs no alloc, loads in place from a const Dispatcher::EMPTY, and stores handles in a chosen Index type.
  • A compact, versioned, CRC-32-checked encoding of dispatchable networks (dispatch::encoding) that the dispatcher validates and loads directly from the bytes.

Everything except Dispatcher, the encoding and their input types needs the default alloc feature.

All time values are integer Ticks. All arithmetic is checked, and every algorithm runs under an explicit Budget. Exhausting a budget yields Error::BudgetExhausted, never a verdict. See docs/design.md in the repository for the formal semantics.

§Example

use temporal_control::{Budget, Stn, Ticks, Verdict};

let mut stn = Stn::new();
let warmup = stn.add_time_point().expect("fits usize");
let analysis = stn.add_time_point().expect("fits usize");
// 5 <= t_analysis - t_warmup <= 15
stn.add_constraint(warmup, analysis, Some(Ticks(5)), Some(Ticks(15)))
    .expect("time points exist");

let verdict = stn.check_consistency(&Budget::UNLIMITED).expect("within budget");
assert!(matches!(verdict, Verdict::Consistent(_)));

Repository: https://github.com/sunsided/temporal-control

Re-exports§

pub use dispatch::DispatchableNetwork;
pub use dispatch::DecodeError;
pub use dispatch::DispatchEdge;
pub use dispatch::DispatchError;
pub use dispatch::Dispatcher;
pub use dispatch::EncodeError;
pub use dispatch::Index;
pub use dispatch::PointKind;
pub use dispatch::Wait;
pub use stn::Bound;
pub use stn::ChordalNetwork;
pub use stn::Constraint;
pub use stn::ConstraintId;
pub use stn::CycleEdge;
pub use stn::IncrementalStn;
pub use stn::MinimalNetwork;
pub use stn::NegativeCycle;
pub use stn::Schedule;
pub use stn::Stn;
pub use stn::Verdict;
pub use stnu::ContingentId;
pub use stnu::Controllability;
pub use stnu::CycleStep;
pub use stnu::DcAlgorithm;
pub use stnu::DerivedEdge;
pub use stnu::DispatchAlgorithm;
pub use stnu::LabelledEdge;
pub use stnu::Reaction;
pub use stnu::SemiReducibleCycle;
pub use stnu::Stnu;

Modules§

dispatch
Onboard dispatcher: executes a dispatchable network online, without allocation.
stn
Simple Temporal Networks (STN).
stnu
Simple Temporal Networks with Uncertainty (STNU) and dynamic controllability.

Structs§

Budget
Explicit compute and memory limits for one algorithm invocation.
Ticks
A point or duration in time, in integer ticks.
TimePoint
Handle of a time point inside one network.

Enums§

Error
Reasons an algorithm could not produce a verdict.