geno_lewm.planning¶
planning
¶
Latent-planning primitives for GenoLeWM.
This package ships the pure-Python action-cost library and factored
action sampler from RFC-0008. The evaluator-first CEM solver core lives
in geno_lewm.planning.cem, and the alpha geno-lewm-plan CLI wires
it to manifest-backed runtime prediction. Stable top-level exports remain
limited to the cost and sampler helpers until the planning API graduates.
DEFAULT_TYPE_COSTS
module-attribute
¶
Default non-negative type costs for weighted_type_cost.
The defaults keep SNVs cheapest, assign a higher penalty to simple indels and MNVs, and make mixed indels the most expensive v1 edit class. Structural variants are outside the v1 planner surface.
DEFAULT_ACTION_TYPE_WEIGHTS
module-attribute
¶
Initial planner proposal over {SNV, INS, DEL, MNV, INDEL}.
ActionSampler
¶
ActionSampler(window: str, *, seed: int | None = None, rng: Random | None = None, edge_margin: int = DEFAULT_EDGE_MARGIN, type_weights: Sequence[EditTypeWeight] = DEFAULT_ACTION_TYPE_WEIGHTS, length_dist: Mapping[int, float] | Sequence[float] | None = None, position_bin_bp: int = 8, position_weights: Mapping[int, float] | Sequence[float] | None = None, max_attempts: int = 256)
Sample valid RelEdit actions from a factored proposal.
The proposal follows planning contract: edit type is categorical, position is uniform or binned-categorical over the window interior, and bases are sampled conditionally on the chosen edit type.
Source code in geno_lewm/planning/sampling.py
sample_edit
¶
Sample one shape-consistent edit inside the configured window.
Source code in geno_lewm/planning/sampling.py
sample_sequence
¶
Sample a candidate edit sequence of length horizon.
sample_sequences
¶
Sample n candidate edit sequences.
Source code in geno_lewm/planning/sampling.py
bp_cost
¶
count_cost
¶
custom_cost
¶
Evaluate and validate a user-provided cost function.
edit_bp_cost
¶
Return the base-pair cost contribution of a single edit.
SNVs cost one base. Insertions and deletions cost their event length excluding the VCF anchor base. MNVs cost their substituted span. Mixed indels cost the larger touched span because both the deleted and inserted sequence are material to the action.
Source code in geno_lewm/planning/costs.py
weighted_type_cost
¶
weighted_type_cost(edits: Sequence[RelEdit], weights: Mapping[EditType, float] = DEFAULT_TYPE_COSTS) -> float
Return the sum of per-edit-type costs for edits.