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

Issue999 #51

Merged
merged 22 commits into from Jul 2, 2021
Merged

Issue999 #51

merged 22 commits into from Jul 2, 2021

Conversation

thomaskeller79
Copy link
Member

@thomaskeller79 thomaskeller79 commented Jun 23, 2021

Pull request for issue999.

Copy link
Member

@FlorianPommerening FlorianPommerening left a comment

Choose a reason for hiding this comment

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

I looked at most the diff. I didn't get around to two parts, but I'm running out of time now. I marked them, so I can have a look at them in the next iteration.

src/search/cegar/utils_landmarks.cc Outdated Show resolved Hide resolved
src/search/cegar/utils_landmarks.cc Outdated Show resolved Hide resolved
namespace landmarks {
class Landmark {
public:
Landmark(std::vector<FactPair> &facts, bool disjunctive, bool conjunctive,
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why there are two parameters disjunctive and conjunctive. What happens if I set both to true? What happens if I use multiple facts and set none of them to true?

Copy link
Member

Choose a reason for hiding this comment

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

Having so many boolean parameters also makes the the code harder to read (especially with default values on the parameters). That is, without looking up the constructor, I don't know what Landmark lm(facts, true, false, true, false) will do and how it is different from Landmark lm(facts, true, false). I have some suggestions how to reduce this:

  • Instead of disjunctive and conjunctive, I'd add a enum class LandmarkType with the values disjunctive, conjunctive, and atomic.
  • If possible, I'd compute is_true_in_goal inside the constructor instead of passing it as a parameter.
  • I don't know what is_derived does but I'd consider making it a mandatory argument.

Copy link
Member Author

Choose a reason for hiding this comment

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

I totally agree with this comment (and many others below), but we intentionally chose not to alter the code on this level and opt for a smaller diff instead as the landmark code is full with issues like this one. As this issue touches almost every landmark file, addressing issues on this level would presumably mean that we can as well re-write the whole landmark code. Instead, I'd suggest to address issues with the code like this one with separate "refactor class X" issues at some point in the future.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to mark all comments below where I want to refer to this comment with "out of scope of issue". If you agree, please resolve those comments.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why there are two parameters disjunctive and conjunctive. What happens if I set both to true? What happens if I use multiple facts and set none of them to true?

We decided to cover this using assertions for now. It will be the goal of issue1023 to make this distinction between conjunctive, disjunctive, and atomic landmarks more explicit by introducing specific classes that are derived from the Landmark class (opposed to introducing an enum here).

* If possible, I'd compute `is_true_in_goal` inside the constructor instead of passing it as a parameter.

As far as I know, is_true_in_goal is something that doesn't need to be computed in most landmark factories but is already known when the landmark is inserted into the landmark graph. Hence, I wouldn't change this, at least not in this issue.

Copy link
Member

Choose a reason for hiding this comment

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

I was just catching up on what happened in the sprint. I'm of course fine with deferring the comments to issue1023. On the point about is_true_in_goal, we should have a look at if this really saves some effort. I think the code would be much cleaner if this was not a parameter so I would even accept a small hit to performance in this case (but I doubt recomputing this would have a measurable impact).

Copy link
Member Author

Choose a reason for hiding this comment

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

I made a note in issue1023 that this comment is still open. I suggest to implement the suggested change there (regardless of the changes to disjunctive and conjunctive I agree this would make the code cleaner) and evaluate how it affects performance.

src/search/landmarks/landmark.h Show resolved Hide resolved
src/search/landmarks/landmark.h Show resolved Hide resolved
src/search/landmarks/landmark_graph.cc Outdated Show resolved Hide resolved
src/search/landmarks/landmark_graph.h Outdated Show resolved Hide resolved
src/search/landmarks/landmark_status_manager.cc Outdated Show resolved Hide resolved
src/search/landmarks/landmark_factory_merged.cc Outdated Show resolved Hide resolved
src/search/landmarks/landmark_graph.cc Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants