xtc_dio_sched(3)

---

xtc_dio_sched(3)

adaptive genetic-algorithm tuner for runtime self-tuning

XTC_DIO_SCHED(3) Library Functions Manual XTC_DIO_SCHED(3)

xtc_dio_sched_create, xtc_dio_sched_destroy, xtc_dio_sched_current, xtc_dio_sched_report, xtc_dio_sched_report_multi, xtc_dio_sched_best, xtc_dio_sched_mutation_rate, xtc_dio_sched_generationadaptive genetic-algorithm tuner for runtime self-tuning

#include <xtc.h>
#include <xtc_dio_sched.h>

int
xtc_dio_sched_create(const xtc_dio_sched_spec_t *spec, xtc_dio_sched_t **out);

void
xtc_dio_sched_destroy(xtc_dio_sched_t *g);

void
xtc_dio_sched_current(const xtc_dio_sched_t *g, int *out_genes);

void
xtc_dio_sched_report(xtc_dio_sched_t *g, double fitness);

void
xtc_dio_sched_report_multi(xtc_dio_sched_t *g, const double *fitness, int n);

void
xtc_dio_sched_best(const xtc_dio_sched_t *g, int *out_genes, double *out_fitness);

double
xtc_dio_sched_mutation_rate(const xtc_dio_sched_t *g);

uint64_t
xtc_dio_sched_generation(const xtc_dio_sched_t *g);

xtc_dio_sched is a small genetic-algorithm tuner for runtime self-tuning of integer “genes” (tunables) against an observed fitness, after Jake Moilanen's genetic scheduler (OLS 2005). A population of candidate gene-sets is evaluated, the best are bred (elitism + per-gene crossover + mutation), and the mutation rate : it falls while fitness improves (hone in) and rises when fitness drops (a workload shift), so the tuner re-converges quickly; it is capped at 45% to keep it from thrashing.

It is a pure, deterministic (seeded) optimiser with no I/O of its own: the caller reads the current candidate's genes, uses them for one evaluation window, and reports the fitness it observed. The xtc_iosched(3) write scheduler drives it with throughput fitness; the unit tests drive it with a synthetic function.

() creates a tuner from spec: n_genes (1 .. XTC_DIO_SCHED_MAX_GENES), per-gene inclusive min/max bounds and init seed candidate, the population size (>= 2), and the PRNG seed. Optionally the genes are partitioned into n_phenos phenotypes -- gene groups each tuned by their own fitness measure via (); n_phenos <= 1 is the single-fitness case.

() copies the genes of the candidate currently under evaluation into out_genes (n_genes ints); use these until the next report.

() reports the fitness observed while using the current candidate (higher is better), advances to the next candidate, and -- when the whole population has been evaluated -- breeds the next generation and adapts the mutation rate. () reports one fitness per phenotype (n must equal the configured n_phenos); each phenotype advances and breeds its own genes independently.

() returns the best gene-set found so far into out_genes and its fitness into out_fitness (either pointer may be NULL) -- the set to use once tuning has converged. () and () return the current adaptive mutation rate and generation counter for observability. () frees the tuner.

xtc_dio_sched_create() returns XTC_OK on success or a negative XTC_E_* code.

xtc_iosched(3)

The XTC Project.

July 3, 2026 Debian

View the mdoc source