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

Add relations to HIRM in an order respecting their base_relations #197

Merged
merged 2 commits into from
Sep 16, 2024

Conversation

ThomasColthurst
Copy link
Collaborator

Fixes #196

cxx/hirm.cc Outdated
if (std::holds_alternative<T_clean_relation>(relation)) {
this->add_relation(prng, name, relation);
HIRM::HIRM(const T_schema& _schema, std::mt19937* prng) {
printf("in hirm\n");
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.


if (!added_a_relation) {
printf("Detected loop in schema\n");
std::exit(1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We've used asserts everywhere else, let's stick with that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

assert's are removed in optimized mode, so I've tried not to use them in places like this where continuing will lead to bad behavior (an infinite loop in this case). grep says that there are 19 such places in the codebase.

}

if (!added_a_relation) {
printf("Detected loop in schema\n");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it'd be helpful to print the relation name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is outside of the loop over relations, so there is no single relation name to print.

@ThomasColthurst ThomasColthurst merged commit c6a2716 into master Sep 16, 2024
2 checks passed
@ThomasColthurst ThomasColthurst deleted the 091124-thomaswc-hirm_model6_fix branch September 16, 2024 16:34
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.

To support model 6, HIRM needs to add base_relations before the relations that use them
2 participants