/** * Developer-experience and quality-of-life utilities for working with POWL * models, event logs, and conformance results. */ import type { EventLog, FitnessResult, PetriNetResult, Trace } from "./types.js"; import type { PowlModel, Powl } from "./index.js"; /** * Pretty-print a POWL model string with indentation. * * ``` * PO=( * nodes={ A, X(B, C), D }, * order={ A-->X(B,C), X(B,C)-->D } * ) * ``` */ export declare function prettyPrint(repr: string, indent?: string): string; /** * Collect all distinct activity labels from a model tree. * Excludes `tau` (silent transitions). */ export declare function modelActivities(model: PowlModel): string[]; /** * Build an adjacency list `{ source: [targets] }` from a model's SPO edges. * Useful for custom visualisation. */ export declare function spoAdjacency(model: PowlModel, spoIdx: number): Record; /** * Describe a model's structure as a compact summary string. * * @example `"SPO(4 nodes, 3 edges) with XOR(2), tau"` */ export declare function modelSummary(model: PowlModel): string; /** * Return the number of distinct activities in a log. */ export declare function logActivities(log: EventLog): string[]; /** * Compute basic statistics for an event log. */ export interface LogStats { traceCount: number; eventCount: number; activityCount: number; avgTraceLength: number; minTraceLength: number; maxTraceLength: number; variantCount: number; } export declare function logStats(log: EventLog): LogStats; /** * Group traces by their activity sequence (variant). * * @returns Map from variant key → traces */ export declare function groupByVariant(log: EventLog): Map; /** * Return the top-N most frequent variants. */ export declare function topVariants(log: EventLog, n?: number): Array<{ variant: string; count: number; frequency: number; }>; /** * Filter log to traces containing a given activity. */ export declare function filterByActivity(log: EventLog, activity: string): EventLog; /** * Filter log to traces between `start` and `end` timestamps (ISO-8601 strings). */ export declare function filterByTimeRange(log: EventLog, start: string, end: string): EventLog; /** * Sample N random traces from a log (for large-log conformance previewing). */ export declare function sampleTraces(log: EventLog, n: number): EventLog; /** * Slice a log to the first `k` events per trace. */ export declare function truncateTraces(log: EventLog, k: number): EventLog; /** * Partition traces into fitting / non-fitting at a given threshold. */ export interface PartitionedTraces { fitting: Trace[]; nonFitting: Trace[]; } export declare function partitionByFitness(log: EventLog, result: FitnessResult, threshold?: number): PartitionedTraces; /** * Return per-activity fitness breakdown. * * For each activity, compute the average fitness of traces that contain it. */ export declare function activityFitness(log: EventLog, result: FitnessResult): Map; /** * Render a conformance result as a compact ASCII table. * * ``` * ┌─────────┬────────────┬────────────┐ * │ case_id │ activities │ fitness │ * ├─────────┼────────────┼────────────┤ * │ case1 │ A → B → C │ 100.0% │ * │ case2 │ A → C │ 78.3% │ * └─────────┴────────────┴────────────┘ * Global: 89.2% | 1/2 perfect * ``` */ export declare function conformanceTable(log: EventLog, result: FitnessResult): string; /** * Compute a fitness histogram with `buckets` equally-spaced bins [0..1]. * * @returns Array of `{ range: "0.0-0.1", count, frequency }` objects. */ export declare function fitnessHistogram(result: FitnessResult, buckets?: number): Array<{ range: string; count: number; frequency: number; }>; /** * Render a Petri net as a DOT (Graphviz) string for visualisation. * * ```dot * digraph { * rankdir=LR; * "p_start" [shape=circle]; * "t_A" [shape=box, label="A"]; * "p_start" -> "t_A"; * } * ``` */ export declare function petriNetToDot(pn: PetriNetResult): string; /** * Return the set of activities visible in a Petri net * (transitions that have a non-null label). */ export declare function petriNetActivities(pn: PetriNetResult): string[]; /** * Run conformance checking in batches to avoid blocking the main thread. * Yields control via `setTimeout(0)` between each batch. * * @param powl Powl instance * @param model POWL model * @param log Full event log * @param batchSize Number of traces per batch (default 50) * @param onProgress Called with `{ done, total }` after each batch */ export declare function conformanceBatched(powl: Powl, model: PowlModel, log: EventLog, batchSize?: number, onProgress?: (p: { done: number; total: number; }) => void): Promise; //# sourceMappingURL=utils.d.ts.map