pub struct PolicyKernel {
pub id: String,
pub knobs: PolicyKnobs,
pub holdout_scores: HashMap<DomainId, f32>,
pub total_cost: f32,
pub cycles: u64,
pub generation: u32,
pub parent_id: Option<String>,
pub replay_verified: bool,
}Expand description
A PolicyKernel is a versioned policy configuration with performance history.
Fields§
§id: StringUnique identifier.
knobs: PolicyKnobsConfiguration knobs.
holdout_scores: HashMap<DomainId, f32>Performance on holdout tasks (domain_id -> score).
total_cost: f32Total cost incurred.
cycles: u64Number of evaluation cycles.
generation: u32Generation (0 = initial, increments on mutation).
parent_id: Option<String>Parent kernel ID (for lineage tracking).
replay_verified: boolWhether this kernel has been verified via replay.
Implementations§
Source§impl PolicyKernel
impl PolicyKernel
Sourcepub fn mutate(&self, child_id: String, rng: &mut impl Rng) -> Self
pub fn mutate(&self, child_id: String, rng: &mut impl Rng) -> Self
Create a mutated child kernel.
Sourcepub fn record_score(&mut self, domain_id: DomainId, score: f32, cost: f32)
pub fn record_score(&mut self, domain_id: DomainId, score: f32, cost: f32)
Record a holdout score for a domain.
Sourcepub fn cost_adjusted_fitness(&self) -> f32
pub fn cost_adjusted_fitness(&self) -> f32
Cost-adjusted fitness: penalizes expensive kernels.
Trait Implementations§
Source§impl Clone for PolicyKernel
impl Clone for PolicyKernel
Source§fn clone(&self) -> PolicyKernel
fn clone(&self) -> PolicyKernel
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PolicyKernel
impl Debug for PolicyKernel
Source§impl<'de> Deserialize<'de> for PolicyKernel
impl<'de> Deserialize<'de> for PolicyKernel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PolicyKernel
impl RefUnwindSafe for PolicyKernel
impl Send for PolicyKernel
impl Sync for PolicyKernel
impl Unpin for PolicyKernel
impl UnsafeUnpin for PolicyKernel
impl UnwindSafe for PolicyKernel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more