IteratedLocalSearch#

class causalbase.order.IteratedLocalSearch(scorer, n_swaps=None, random_state=None, kick='mixed')[source]#

Iterated insertion search with random-transposition kicks.

Parameters:
scorerOrderScorer

Order evaluator.

n_swapsint or None, default=None

Transpositions per perturbation; ceil(ln p) when None. Kept as n_swaps with that default resolved.

random_stateint or None, default=None

Seeds every random choice (visiting order and perturbations); None draws a fresh seed.

kick{“swaps”, “topo”, “mixed”}, default=”mixed”

swaps: k random transpositions. topo: a random topological order of the network the evaluator learns from the order, the same DAG reached through another order (the evaluator depends on the order, not only on the DAG). mixed: either, with equal probability.

perturb(order)[source]#

Return order perturbed by the configured kick.

For transpositions, the transposed pairs of variables are left in last_swaps (empty after a topological kick).

run(start, time_limit=None, max_iterations=None)[source]#

Search from start until a time or iteration limit.

The search stops after time_limit seconds or max_iterations perturbations.