Skip to content

Change some traits' associated types to type parameters#39

Open
Bubbler-4 wants to merge 6 commits into
xgillard:masterfrom
Bubbler-4:assoc-type-vs-type-param
Open

Change some traits' associated types to type parameters#39
Bubbler-4 wants to merge 6 commits into
xgillard:masterfrom
Bubbler-4:assoc-type-vs-type-param

Conversation

@Bubbler-4

Copy link
Copy Markdown
Contributor

Guessing from the technical note for WidthHeuristic, all traits that don't directly define the problem are designed to be problem-agnostic, and should be written using type parameters instead of associated types.

This PR changes the traits DecisionDiagram, Fringe, Cache, DominanceChecker, and SubProblemRanking to use type parameters instead of associated types. The former three are obviously part of the "engine"; the other two act as wrappers for user-implemented traits Dominance and StateRanking respectively, and therefore can be considered problem-agnostic as well. All examples compiled and example tests passed without modification.

I'm working on generalizing Solution to allow types other than Vec<Decision>, including

  • a linked list of chunks of Decisions, to avoid duplication
  • a user-supplied type, e.g. a bitset if the problem involves binary variables and the variables are visited in a fixed order

and this PR is expected to make the change a bit cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant