Skip to content

Conversation

@grucla
Copy link
Contributor

@grucla grucla commented Feb 10, 2026

No description provided.

}
}
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This computes a logical OR, where we want an AND, I think. I recommend to use std::all_of here and in some places below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tanja and I were not sure about this but went with OR because we thought that for the completeness of the configuration it is enough if one of the open lists is "safe", i.e. ensures that all non-dead-ends are considered.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right. My knee-jerk reaction was wrong and I should've thought about this more carefully. But I think this method deserves a comment :)

I had some other minor comments while looking over this, see below.

}
return true;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return open_list->pruning_is_safe() && pruning_method->is_safe();

EvaluationContext &eval_context) const = 0;
virtual bool pruning_is_safe() const {
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this a pure virtual function, like the ones above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same discussion as with is_complete of search_algorithm.h. For the moment I would keep it like this because the completeness check is not yet implemented for all open lists.

exitcode = ExitCode::SEARCH_UNSOLVABLE;
} else {
exitcode = ExitCode::SEARCH_UNSOLVED_INCOMPLETE;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't it also be that the search ran out of time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it but I'm not completely sure. In that case it should be enough to extend the check to something like search_algorithm->is_complete() && search_finished_in_time, right? (I haven't yet looked into how to do the second part of the check.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think so.

virtual void save_plan_if_necessary();
virtual bool is_complete() const {
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also become a pure virtual function eventually, but I guess you want to minimize the diff until more algorithms are supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we could also keep it as it is to have a default value for future search algorithms but I do not have a strong opinion on this. For the moment I would definitely keep it like this because the completeness check is not yet implemented for all search algorithms.

}
}
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You're right. My knee-jerk reaction was wrong and I should've thought about this more carefully. But I think this method deserves a comment :)

I had some other minor comments while looking over this, see below.

return false;
}
// Even if the first evaluator is unsafe we can still say that
// pruning_is_safe is true if (allow_unsafe_pruning is false and) at least
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// pruning_is_safe is true if (allow_unsafe_pruning is false and) at least
// pruning is safe if (allow_unsafe_pruning is false and) at least

// Even if the first evaluator is unsafe we can still say that
// pruning is safe if (allow_unsafe_pruning is false and) at least
// one other evaluator is safe.
for (auto eval : evaluators) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (auto eval : evaluators) {
for (const shared_ptr<Evaluator> &evaluator : evaluators)

to be consistent with e.g. get_path_dependent_evaluators in this file
and to have less updates on the reference counter of the smart pointers in evaluators.

template<class Entry>
bool AlternationOpenList<Entry>::pruning_is_safe() const {
// If at least one of the sub-lists ensures that no solvable state is
// pruned we know that this also holds for AlternationOpenList.
Copy link
Contributor

Choose a reason for hiding this comment

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

template<class Entry>
bool AlternationOpenList<Entry>::pruning_is_safe() const {
// If at least one of the sub-lists ensures that no solvable state is
// pruned we know that this also holds for AlternationOpenList.
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

3 participants