pub struct Planner { /* private fields */ }Expand description
Proposal scorer and ranker.
Implementations§
Source§impl Planner
impl Planner
pub fn new(config: PlannerConfig) -> Planner
Sourcepub fn score(
&self,
proposal: &ActionProposal,
initial_state: Option<&HashMap<String, Value>>,
registered_tools: Option<&HashSet<String>>,
) -> ScoredProposal
pub fn score( &self, proposal: &ActionProposal, initial_state: Option<&HashMap<String, Value>>, registered_tools: Option<&HashSet<String>>, ) -> ScoredProposal
Score a single proposal using static verification.
Sourcepub fn rank(
&self,
candidates: &[ActionProposal],
initial_state: Option<&HashMap<String, Value>>,
registered_tools: Option<&HashSet<String>>,
) -> Vec<ScoredProposal>
pub fn rank( &self, candidates: &[ActionProposal], initial_state: Option<&HashMap<String, Value>>, registered_tools: Option<&HashSet<String>>, ) -> Vec<ScoredProposal>
Rank multiple candidate proposals. Returns scored proposals sorted by score descending (best first).
Sourcepub fn rank_with_feedback(
&self,
candidates: &[ActionProposal],
initial_state: Option<&HashMap<String, Value>>,
registered_tools: Option<&HashSet<String>>,
feedback: Option<&ToolFeedback>,
) -> Vec<ScoredProposal>
pub fn rank_with_feedback( &self, candidates: &[ActionProposal], initial_state: Option<&HashMap<String, Value>>, registered_tools: Option<&HashSet<String>>, feedback: Option<&ToolFeedback>, ) -> Vec<ScoredProposal>
Rank with historical tool feedback from trajectory store.
Sourcepub fn pick_best(
&self,
candidates: &[ActionProposal],
initial_state: Option<&HashMap<String, Value>>,
registered_tools: Option<&HashSet<String>>,
) -> Option<(usize, ScoredProposal)>
pub fn pick_best( &self, candidates: &[ActionProposal], initial_state: Option<&HashMap<String, Value>>, registered_tools: Option<&HashSet<String>>, ) -> Option<(usize, ScoredProposal)>
Pick the best valid proposal from candidates. Returns None if all candidates have errors.
Sourcepub fn rank_with_outcome(
&self,
candidates: &[ActionProposal],
initial_state: Option<&HashMap<String, Value>>,
registered_tools: Option<&HashSet<String>>,
feedback: Option<&ToolFeedback>,
model: &dyn EffectModel,
value: &dyn ValueFunction,
) -> Vec<ScoredProposal>
pub fn rank_with_outcome( &self, candidates: &[ActionProposal], initial_state: Option<&HashMap<String, Value>>, registered_tools: Option<&HashSet<String>>, feedback: Option<&ToolFeedback>, model: &dyn EffectModel, value: &dyn ValueFunction, ) -> Vec<ScoredProposal>
Rank candidates by predicted outcome as well as validity/cost
(Code World Models Slice 3). For each candidate, the predicted final
state is computed with car_verify::simulate_with_model against the
injected model — a verified Code World Model (e.g. a
car_verify::cwm::GatedEffectModel) — and scored by value. The
outcome value is blended into the static score with
PlannerConfig::outcome_weight:
score = static_score * (1 - outcome_weight) + outcome_value * outcome_weight for valid proposals (invalid ones stay 0.0).
This is the step that makes planning outcome-aware: a plan that reaches
the goal can outrank a cheaper plan that doesn’t. It is library-only by
construction — like car_verify::synthesize_cwm, it takes injected trait
objects (the model and the value function), which don’t cross the FFI
boundary; the stateless predictive primitive is simulate_with_predictions.
With outcome_weight == 0.0 (the default) the blend is a no-op and the
ordering matches Planner::rank_with_feedback exactly — opting in an
EffectModel never silently changes behavior.
Auto Trait Implementations§
impl Freeze for Planner
impl RefUnwindSafe for Planner
impl Send for Planner
impl Sync for Planner
impl Unpin for Planner
impl UnsafeUnpin for Planner
impl UnwindSafe for Planner
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more