Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epic backtracking constraint #910

Merged
merged 1 commit into from
May 24, 2024
Merged

Epic backtracking constraint #910

merged 1 commit into from
May 24, 2024

Conversation

kris-brown
Copy link
Contributor

Just as we have a monic constraint option, the epic constraint keyword can be used to componentwise prune partial homomorphisms in the search process that have no chance of becoming an epic homomorphism.

By keeping track of how many elements have yet to be assigned in the domain and a vector for each element in the codomain (how many elements map to each element), we can check this. When assigning a new element, we decrement the domain unassigned counter and we increment the counter on the element in the codomain (vice-versa when unassigning an element).

This is a repost of #602 which cannot be rebased because HomSearch has now been moved to its own file.

This is relevant for incremental hom search.

Copy link
Member

@epatters epatters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Kris, LGTM!

@@ -186,10 +186,13 @@ struct BacktrackingState{
codom::Codom
type_components::LooseFun
predicates::Predicates
image::Image # Negative of image for epic components or if finding an epimorphism
unassigned::Unassign # "# of unassigned elems in domain of a component

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct is becoming rather big. I wonder if it's worth trying to modularize the algorithm and associated data structures. Not being requested for this PR but something to think about.

@epatters epatters merged commit e5f3576 into main May 24, 2024
10 checks passed
@epatters epatters deleted the surjection2 branch May 24, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants