Module rule_engine Copy item path Source _dependencies register_rule_set Register a rule set with the given name, priority, and dependencies.Example 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. RuleSet A structure representing a set of rules with a name, priority, and dependencies. ApplicationError RewriteError Represents errors that can occur during the model rewriting process. 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_priorities Convert a list of rule sets into a final map of rules to their priorities. 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 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_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 Returns a copied Vec
of all rules registered with the register_rule
macro. get_rules_vec Get a final ordering of rules based on their priorities and names. 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. rewrite_naive A naive, exhaustive rewriter for development purposes. Applies rules in priority order,
favouring expressions found earlier during preorder traversal of the tree. ApplicationResult The result of applying a rule to an expression.
Contains either a set of reduction instructions or an error. distributed_slice register_rule Register a rule with the given rule sets and priorities.