Module rule_engine

Source

Modules§

_dependencies

Macros§

register_rule_set
This procedural macro registers a rule set with the global registry. It may be used in any downstream crate.

Structs§

Reduction
Represents the result of applying a rule to an expression within a model.
Rule
A rule with a name, application function, and rule sets.
RuleData
Holds a rule and its priority, along with the rule set it came from.
RuleSet
A structure representing a set of rules with a name, priority, and dependencies.

Enums§

ApplicationError
RewriteError
Represents errors that can occur during the model rewriting process.

Functions§

get_all_rule_sets
Get all rule sets Returns a Vec of static references to all rule sets registered with the register_rule_set macro. Rule sets are not guaranteed to be in any particular order.
get_all_rules
Returns a copied Vec of all rules registered with the register_rule macro.
get_rule_by_name
Get a rule by name. Returns the rule with the given name or None if it doesn’t exist.
get_rule_set_by_name
Get a rule set by name. Returns the rule set with the given name or None if it doesn’t exist.
get_rule_sets_for_solver_family
Get all rule sets for a given solver family. Returns a Vec of static references to all rule sets that are applicable to the given solver family.
get_rules
Build a list of rules to apply (sorted by priority) from a list of rule sets.
get_rules_grouped
Get rules grouped by priority from a list of rule sets.
resolve_rule_sets
Resolves the final set of rule sets to apply based on target solver and extra rule set names.
rewrite_model
Rewrites the given model by applying a set of rules to all its constraints, until no more rules can be applied.
rewrite_naive
A naive, exhaustive rewriter for development purposes. Applies rules in priority order, favouring expressions found earlier during preorder traversal of the tree.

Type Aliases§

ApplicationResult
The result of applying a rule to an expression. Contains either a set of reduction instructions or an error.

Attribute Macros§

distributed_slice
register_rule
This procedural macro registers a decorated function with conjure_rules’ global registry, and adds the rule to one or more RuleSet’s.