Issue989

Title make LandmarkGraph code more readable
Priority wish Status resolved
Superseder Nosy List clemens, florian, jendrik, malte, salome, silvan, thomas
Assigned To florian Keywords
Optional summary

Created on 2021-01-22.10:48:14 by clemens, last changed by florian.

Messages
msg10002 (view) Author: florian Date: 2021-02-05.15:57:12
OK, I added this with a commit directly in the main branch.
msg10001 (view) Author: malte Date: 2021-02-05.14:55:56
Looks very good to me!
msg10000 (view) Author: florian Date: 2021-02-05.12:21:36
Should I add an entry like this?

- For developers: We cleaned up the code of LandmarkGraph. Some of the public
  methods were renamed. This class will undergo further changes in the future.
  http://issues.fast-downward.org/issue989
msg9997 (view) Author: malte Date: 2021-02-04.21:06:26
We do mention things that are relevant for developers only because we assume that a good part of our target audience wants to work on the code and not just use it as-is. But we are generally more brief with these and put them near the end of the changelog to emphasize the user-facing changes.

To see some examples, look at existing entries beginning with "For developers:".
msg9996 (view) Author: silvan Date: 2021-02-04.15:45:55
I also don't know what our convention is for such cases. In my opinion, we wouldn't need an entry.
msg9995 (view) Author: florian Date: 2021-02-04.13:25:16
By the way, I assumed that we don't want a change log message for this because it is a cosmetic change that is not relevant for users. Is that correct, or do we still want an entry?
msg9994 (view) Author: florian Date: 2021-02-04.13:22:46
Great, thanks. The tests ran through and I merged the issue.
msg9993 (view) Author: thomas Date: 2021-02-04.13:11:54
I can confirm that the dump method works.

Good that you also include the fix to the local test, I had that in issue990 as well (but didn't include the fix as I wasn't sure about the convention regarding non-issue related changes like this)
msg9992 (view) Author: florian Date: 2021-02-04.12:56:57
I just merged with issue990 and pushed to the issue branch. 
https://github.com/aibasel/downward/pull/21
Do you want to test if the dump method works in your context before we merge this?

Otherwise I would merge this soon. My local test showed an error in the LP solver code that didn't show on the github actions (I guess due to an issue with the clang-tidy version). I fixed it (https://github.com/aibasel/downward/pull/21/commits/f8e3b07d) but now the Github actions started from scratch, so I have to wait another iteration before the merge.
msg9991 (view) Author: thomas Date: 2021-02-04.12:26:55
Neither do I understand why it crashed, but passing a TaskProxy to dump did it for me. I can only assume that the TaskProxy object inside the LandmarkGraph class somehow gets corrupted, but then I don't know enough about the proxy objects. Thanks for checking!

Issue990 has been merged yesterday, so I believe this issue is next on the list. If you need help merging because of merge conflicts with issue990 let me know!
msg9990 (view) Author: florian Date: 2021-02-04.12:22:41
I moved the method out of the class, so now you have to pass in the correct task proxy. I don't understand why it crashed before, so I don't know if this fixes it but if your fix work, then it does sound like merging this issue would fix the crash.
msg9989 (view) Author: thomas Date: 2021-02-04.11:52:48
Currently, the LandmarkGraph::dump() method makes the planner crash, presumably because of the TaskProxy object (I managed to get rid of the crash by passing a new TaskProxy object to dump). Clemens said that this might have been resolved in this issue. Florian, can you verify this?
msg9978 (view) Author: florian Date: 2021-02-02.18:18:22
We discussed the remaining issues live. I will merge and push once issue990 is merged.

I did one more change after our discussion flagged by the github actions: the task_proxy was no longer used in the class, so I removed it.
msg9965 (view) Author: silvan Date: 2021-02-01.10:27:55
I had a look at the changes of LandmarkGraph and left a few comments.

I don't think experiments are needed. Regarding coordinating, it could be best to discuss this on discord/in a break today.
msg9963 (view) Author: malte Date: 2021-01-30.18:32:34
I left one review comment. There are a few changes that affect performance (changes in how vectors are constructed), but if you think no experiments are needed, I'm fine with that. Merging this should probably be coordinated with merging the other landmark issues that are ready to be merged (or close to being ready).
msg9942 (view) Author: malte Date: 2021-01-29.13:07:24
I would suggest a new issue rather than issue334. It's good to have more specific issues rather than ones with catch-all names. And this is a change that I would not combine with other changes because it requires its own experiments etc.
msg9927 (view) Author: silvan Date: 2021-01-29.08:52:18
For this issue, I'd suggest to keep things to only renaming. I'm fine with either cost or min_cost.

Addressing the issue of not having costs in the landmark factories should happen somewhere else. Maybe we could use issue334 for this, which I would otherwise consider to close because being done/addressed by newer issues linked from issue987.
msg9924 (view) Author: malte Date: 2021-01-28.22:42:26
Yes, and this difference in behaviour between different landmark factories isn't the intended one.

From the intention, landmark factories should find landmarks and landmark orderings, and nothing more. The cost of a landmark isn't an intrinsic property but a derived feature that should be computed by the heuristic based on the achievers (and possibly first achievers). Because there wasn't originally a clean separation between factories and heuristics, these costs ended up on the factory side and now we see that they are handled inconsistently.

Presumably when action costs were added to Fast Downward (or rather LAMA at the time, which was then a fork), lm_rhw was the only generation method that was updated to take action costs into account because it was the only generation method anyone cared about.
msg9923 (view) Author: florian Date: 2021-01-28.22:06:10
Maybe I'm explaining it wrong. The constructor has a default "cost" of 1 and most landmark factories leave it at that (lmcount then adds these "costs" to effectively count the landmarks). One factory uses a the minimal cost of any achiever in place of this default cost of 1, so lmcount adds up these costs instead of counting the landmarks.
msg9919 (view) Author: malte Date: 2021-01-28.21:18:21
> Thanks for the review. I thought about "min_cost" for a while as well. While the
> other factories do not set any values here, they rely on the default value of 1. In
> the heuristic this is then used as the contribution of this landmark to the
> heuristic value.

This just sounds like a bug that should be fixed.
msg9904 (view) Author: malte Date: 2021-01-28.19:21:18
Without having looked at the code and having to guess a little bit at the contexte, "cost" sounds good to me because this is what the literature uses.

No matter what the name is, I don't think the landmark factories have any business setting costs here, and there is certainly no reason for LM_RHW to be different from the others. In other words, this probably needs to be changed. (Unless I'm misunderstanding what this is about.)
msg9887 (view) Author: florian Date: 2021-01-28.16:03:51
Thanks for the review. I thought about "min_cost" for a while as well. While the other factories do not set any values here, they rely on the default value of 1. In the heuristic this is then used as the contribution of this landmark to the heuristic value. I thought the "cost of the landmark" more or less covers this idea but I'm fine with other names as well. I just thought min_cost is not appropriate (especially with the old documentation of "minimal cost of achieving operators", which is just wrong for other factories).
msg9882 (view) Author: clemens Date: 2021-01-28.14:26:42
I have had a look at your changes. There's not much to say in my opinion. The only thing I'm not so sure about is the renaming of the min_cost member to cost. Both names do not seem appropriate as only the LandmarkFactoryRpgSasp sets this value, otherwise it holds its initial value (which is 1). Hence, for all other factories it has nothing to do with a cost at all, but for the RpgSasp (= RHW landmarks) case, it really is the min_cost.

Other than that, there is an outdated call to dump the landmark graph, which is commented out anyways. Everything else looks good to me.
msg9873 (view) Author: florian Date: 2021-01-28.00:42:40
I prepared a pull request 
https://github.com/aibasel/downward/pull/21

It might be easier to review this by looking at individual commits (I tried keeping each of them small and simple):

https://github.com/aibasel/downward/pull/21/commits

Can someone have a look?
msg9791 (view) Author: clemens Date: 2021-01-22.10:48:14
When working on issue988, we discussed that the code readability could be improved by changes like renaming variables or moving implementations to the source file instead of the header (i.e., the LandmarkNode class is implemented entirely in landmark_graph.h).
History
Date User Action Args
2021-02-05 15:57:13floriansetmessages: + msg10002
2021-02-05 14:55:56maltesetmessages: + msg10001
2021-02-05 12:21:36floriansetmessages: + msg10000
2021-02-04 21:06:26maltesetmessages: + msg9997
2021-02-04 15:45:55silvansetmessages: + msg9996
2021-02-04 13:25:16floriansetmessages: + msg9995
2021-02-04 13:22:46floriansetstatus: reviewing -> resolved
messages: + msg9994
2021-02-04 13:11:54thomassetmessages: + msg9993
2021-02-04 12:56:57floriansetmessages: + msg9992
2021-02-04 12:26:56thomassetmessages: + msg9991
2021-02-04 12:22:41floriansetmessages: + msg9990
2021-02-04 11:52:48thomassetmessages: + msg9989
2021-02-02 18:18:22floriansetmessages: + msg9978
2021-02-01 10:27:55silvansetmessages: + msg9965
2021-01-30 18:32:34maltesetmessages: + msg9963
2021-01-29 13:07:27maltesetmessages: + msg9942
2021-01-29 08:52:18silvansetmessages: + msg9927
2021-01-28 22:42:26maltesetmessages: + msg9924
2021-01-28 22:06:10floriansetmessages: + msg9923
2021-01-28 21:18:21maltesetmessages: + msg9919
2021-01-28 19:21:18maltesetmessages: + msg9904
2021-01-28 16:03:51floriansetmessages: + msg9887
2021-01-28 14:26:42clemenssetmessages: + msg9882
2021-01-28 00:42:40floriansetstatus: chatting -> reviewing
messages: + msg9873
2021-01-27 14:35:43floriansetassignedto: florian
nosy: + florian
2021-01-22 10:48:14clemenscreate