pub struct RootIntent {
pub id: IntentId,
pub kind: IntentKind,
pub objective: Option<Objective>,
pub scope: Scope,
pub constraints: Vec<IntentConstraint>,
pub success_criteria: SuccessCriteria,
pub budgets: Budgets,
}Expand description
The Root Intent — constitution of a Converge job.
This is the only entry point into a Converge runtime. It defines the universe of discourse, what is allowed, and what success means.
Fields§
§id: IntentIdUnique identifier.
kind: IntentKindThe class of problem.
objective: Option<Objective>What the system should optimize.
scope: ScopeWhat is in-bounds.
constraints: Vec<IntentConstraint>Hard and soft constraints.
success_criteria: SuccessCriteriaSuccess criteria.
budgets: BudgetsExecution budgets.
Implementations§
Source§impl RootIntent
impl RootIntent
Sourcepub fn new(kind: IntentKind) -> Self
pub fn new(kind: IntentKind) -> Self
Creates a new Root Intent with the given kind.
Sourcepub fn with_objective(self, objective: Objective) -> Self
pub fn with_objective(self, objective: Objective) -> Self
Sets the objective.
Sourcepub fn with_scope(self, scope: Scope) -> Self
pub fn with_scope(self, scope: Scope) -> Self
Sets the scope.
Sourcepub fn with_constraint(self, constraint: IntentConstraint) -> Self
pub fn with_constraint(self, constraint: IntentConstraint) -> Self
Adds a constraint.
Sourcepub fn with_success_criterion(self, criterion: SuccessCriterion) -> Self
pub fn with_success_criterion(self, criterion: SuccessCriterion) -> Self
Adds a success criterion (required).
Sourcepub fn with_success_criteria(self, criteria: SuccessCriteria) -> Self
pub fn with_success_criteria(self, criteria: SuccessCriteria) -> Self
Sets the success criteria.
Sourcepub fn with_budgets(self, budgets: Budgets) -> Self
pub fn with_budgets(self, budgets: Budgets) -> Self
Sets the budgets.
Sourcepub fn validate(&self) -> Result<(), IntentValidationError>
pub fn validate(&self) -> Result<(), IntentValidationError>
Validates the Root Intent.
§Errors
Returns error if:
- Scope is not defined
- Success criteria are not explicit
Sourcepub fn to_seed_facts(&self) -> Vec<Fact>
pub fn to_seed_facts(&self) -> Vec<Fact>
Creates initial seed facts from this intent.
These facts are added to the context at the start of execution.
Sourcepub fn hard_constraints(&self) -> Vec<&IntentConstraint>
pub fn hard_constraints(&self) -> Vec<&IntentConstraint>
Returns hard constraints.
Sourcepub fn soft_constraints(&self) -> Vec<&IntentConstraint>
pub fn soft_constraints(&self) -> Vec<&IntentConstraint>
Returns soft constraints.
Sourcepub fn is_successful(&self, ctx: &Context) -> bool
pub fn is_successful(&self, ctx: &Context) -> bool
Checks if success criteria are satisfied by the context.
Trait Implementations§
Source§impl Clone for RootIntent
impl Clone for RootIntent
Source§fn clone(&self) -> RootIntent
fn clone(&self) -> RootIntent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more