Issue914

Title M&S refactoring part 2: when terminating with several factors left, exclude factors with only goal states
Priority wish Status resolved
Superseder Nosy List jendrik, malte, silvan
Assigned To silvan Keywords
Optional summary
Part of issue567.

Created on 2019-05-07.19:08:59 by silvan, last changed by silvan.

Summary
Part of issue567.
Messages
msg9179 (view) Author: silvan Date: 2020-01-29.16:29:14
For the record: this has now been silently fixed in the master.
msg9176 (view) Author: silvan Date: 2020-01-24.12:22:58
I discovered a bug in the code introduced in this issue which lead to the feature only being correctly implemented partially. Normally, I would just fix this in default, but with our new release cylce, I was wondering whether there is reason to not do so and if such as fix should be documented in the CHANGES file.
msg8976 (view) Author: silvan Date: 2019-10-03.10:18:28
Thanks a lot!
msg8971 (view) Author: jendrik Date: 2019-10-02.08:59:33
I left some minor comments, but this looks good to be merged.
msg8970 (view) Author: jendrik Date: 2019-09-27.12:40:52
Sure, I'll have another look.
msg8969 (view) Author: silvan Date: 2019-09-26.17:30:23
Thanks! I polished the documentation accordingly. Jendrik, can I get you to do a review? :-)
msg8968 (view) Author: malte Date: 2019-09-26.15:26:30
I've left some general and polishing comments. If you can get Jendrik to do a review before merging, then I'm fine with merging this. Otherwise I'm not sure when I'll be able to take a closer look.
msg8966 (view) Author: silvan Date: 2019-09-26.14:29:30
Added link to meta issue567. 

This is "ready for being merged" and I would like to ideally merge it before we start switching to git. Any chance to get a final look at the PR? :-)

BTW., I just saw that bitbucket diffs now have a button that shows previous comments on the same file which might be very useful in cases like this where we already went through an iteration of code review.
msg8918 (view) Author: silvan Date: 2019-06-17.17:38:19
Added. Please let me know if you are happy with my latest changes.
msg8917 (view) Author: malte Date: 2019-06-17.13:30:34
> Regarding the changelog, where do I find this?

We mostly discussed this live, in the second meeting on the release. There isn't
much documentation, but check this:

http://www.fast-downward.org/ForDevelopers/ChangelogFormat

> The file CHANGES.md looks like it should only be changed once the next
> release time/name is set in stone.

We want to polish it at this point, but it will be easier to start entering some
things when they're fresh in our mind. I'd suggest adding a section for 2019.06+
and adding entries there.
msg8916 (view) Author: silvan Date: 2019-06-17.12:36:44
I made another iteration of changes.

Regarding the changelog, where do I find this? The file CHANGES.md looks like it
should only be changed once the next release time/name is set in stone.
msg8912 (view) Author: malte Date: 2019-06-16.16:49:48
I left some review comments. I didn't write it on bitbucket, but please also add
a changelog entry.
msg8887 (view) Author: silvan Date: 2019-06-12.17:05:08
Reminder :-)
msg8864 (view) Author: silvan Date: 2019-06-07.11:36:51
I'll remind you then.

For completeness, here are the latest results:
https://ai.dmi.unibas.ch/_tmp_files/sieverss/issue914-v4-issue914-base-issue914-v4-compare.html
msg8843 (view) Author: malte Date: 2019-06-06.14:28:05
Silvan, happy to look at this after my IJCAI deadline (= on Tuesday). Please
remind me.
msg8842 (view) Author: jendrik Date: 2019-06-06.14:19:17
I left some comments. Feel free to ignore them as I'm not familiar with the M&S
code.
msg8841 (view) Author: silvan Date: 2019-06-06.13:35:10
Even though this is not part of the sprint stories, I would be happy to get this
off the list :-) Anyone up for another, hopefully final review?
msg8788 (view) Author: silvan Date: 2019-05-20.16:57:18
Yes, I misunderstood a previous comment, I guess. The code now again checks if
all states are goal states and additionally checks if the factor has been pruned.

Updated results:
https://ai.dmi.unibas.ch/_tmp_files/sieverss/issue914-v3-issue914-base-issue914-v3-compare.html
msg8787 (view) Author: malte Date: 2019-05-16.20:00:29
I thought the suggestion was about whether all states are goal states, not
whether all goal distances are 0 (based on the title and first message). That
doesn't require the distances.
msg8786 (view) Author: silvan Date: 2019-05-16.19:31:20
> but I think it
> would also be easy enough to just keep track of this when transformations are
> applied.
It is certainly possible, but I wouldn't call it an "easy" change, since we
would need to keep track of two things: for each factor, we need to know if its
corresponding M&S table contains at least one "undefined value" or not, and we
would  need to know if all (other, explicitly represented) states have heuristic
value of 0 or not. 

An additional complication arises from the fact that computing goal distances is
only done if the merge or shrink strategy requires it. Otherwise, goal distances
are only computed in the end for the final heuristic. In the latter case, we
would need to determine for each factor if it is trivial or not in end anyway. 

So I think I would go with determining this information in the end only.
msg8785 (view) Author: malte Date: 2019-05-16.14:21:35
> To semantically determine whether a M&S representation maps everything
> to 0, we would need to make sure that no state is pruned, which would include
> any component representation. Do you consider doing this computation on demand
> an option?

Going over the tables on-demand would not be terribly expensive, but I think it
would also be easy enough to just keep track of this when transformations are
applied.
msg8784 (view) Author: silvan Date: 2019-05-16.14:18:38
I agree with all points.

I actually like the idea of having something like "trivial" at the M&S
representation instead of the transition system. More generally, we could move
the fields "int num_variables" and "vector<int> incorporated_variables" from the
transition system to the M&S representation, since the M&S representation is the
only place where we need to know something about variables also conceptually
(and not only for printing).

Regarding the third point: I understand the concern but I don't know how we can
avoid it. To semantically determine whether a M&S representation maps everything
to 0, we would need to make sure that no state is pruned, which would include
any component representation. Do you consider doing this computation on demand
an option?
msg8783 (view) Author: malte Date: 2019-05-14.17:34:33
The code doesn't look pretty to me, I'm not sure I like the ratio of code
complexity vs. utility. What I don't like:

- A long method with a very generic name. Could be improved by extracting the
new code into a method with a more telling name.

- New code depends on the planning task representation (TaskProxy), where our
general strategy is "convert to the M&S representation initially, then do
everything base on that." I'd be happier if the information were tracked within
the M&S representation, for example by factors keeping track if they are "trivial".

- Related to this, this is now a syntactic criterion rather than a semantic one,
which runs counter to the M&S spirit. We can have a zero heuristic due to
shrinking without the new code detecting it.
msg8782 (view) Author: silvan Date: 2019-05-14.15:37:32
PR is updated, performance didn't change:
https://ai.dmi.unibas.ch/_tmp_files/sieverss/issue914-v2-issue914-base-issue914-v2-compare.html
msg8781 (view) Author: silvan Date: 2019-05-14.10:46:43
In the extreme case, we could prune all non-goal states and only keep goal
states, in which the implementation would be wrong because the heuristic would
also have infinity values. For the same reason, just checking if all non-pruned
states have heuristic values of 0 won't work. So I think the only way is to look
into the variables they factor represents. I'll change the implementation
accordingly.
msg8779 (view) Author: malte Date: 2019-05-13.16:02:00
Does having only goal states imply that the heuristic value is 0?
How/where is the case handled where a state is mapped to nothing because we know
it's dead?
msg8776 (view) Author: silvan Date: 2019-05-13.14:58:51
Jendrik, could you maybe have a look? The diff is small :-)
msg8774 (view) Author: silvan Date: 2019-05-08.14:46:06
Oups, wrong link:
https://bitbucket.org/SilvanS/fd-dev/pull-requests/49/issue914/diff
msg8773 (view) Author: malte Date: 2019-05-08.12:11:52
Depends on how much it complicates the code. :-) Can you link a pull request?
msg8771 (view) Author: silvan Date: 2019-05-08.09:12:21
It is indeed a small, nearly unnoticeable change (I was just curious):
https://ai.dmi.unibas.ch/_tmp_files/sieverss/issue914-v1-issue914-base-issue914-v1-compare.html

PR:
https://ai.dmi.unibas.ch/_tmp_files/sieverss/issue914-v1-issue914-base-issue914-v1-compare.html

Any objections to merging this?
msg8770 (view) Author: silvan Date: 2019-05-07.19:08:59
When using a time limit on the merge-and-shrink main loop, the remaining factors
are used in a maximum heuristic. As a small improvement of efficiency, we can
exclude factors that consist exclusively of goal states.
History
Date User Action Args
2020-01-29 16:29:14silvansetmessages: + msg9179
2020-01-24 12:22:58silvansetmessages: + msg9176
2019-10-03 10:18:28silvansetstatus: reviewing -> resolved
messages: + msg8976
2019-10-02 08:59:33jendriksetmessages: + msg8971
2019-09-27 12:40:52jendriksetmessages: + msg8970
2019-09-26 17:30:23silvansetmessages: + msg8969
2019-09-26 15:26:30maltesetmessages: + msg8968
2019-09-26 14:29:30silvansettitle: M&S: when terminating with several factors left, exclude factors with only goal states -> M&S refactoring part 2: when terminating with several factors left, exclude factors with only goal states
messages: + msg8966
summary: Part of issue567.
2019-06-17 17:38:19silvansetmessages: + msg8918
2019-06-17 13:30:34maltesetmessages: + msg8917
2019-06-17 12:36:44silvansetmessages: + msg8916
2019-06-16 16:49:48maltesetmessages: + msg8912
2019-06-12 17:05:08silvansetmessages: + msg8887
2019-06-07 11:36:51silvansetmessages: + msg8864
2019-06-06 14:28:05maltesetmessages: + msg8843
2019-06-06 14:19:17jendriksetmessages: + msg8842
2019-06-06 13:35:10silvansetmessages: + msg8841
2019-05-20 16:57:18silvansetmessages: + msg8788
2019-05-16 20:00:29maltesetmessages: + msg8787
2019-05-16 19:31:20silvansetmessages: + msg8786
2019-05-16 14:21:35maltesetmessages: + msg8785
summary: > To semantically determine whether a M&S representation maps everything > to 0, we would need to make sure that no state is pruned, which would include > any component representation. Do you consider doing this computation on demand > an option? Going over the tables on-demand would not be terribly expensive, but I think it would also be easy enough to just keep track of this when transformations are applied. -> (no value)
2019-05-16 14:21:21maltesetsummary: > To semantically determine whether a M&S representation maps everything > to 0, we would need to make sure that no state is pruned, which would include > any component representation. Do you consider doing this computation on demand > an option? Going over the tables on-demand would not be terribly expensive, but I think it would also be easy enough to just keep track of this when transformations are applied.
2019-05-16 14:18:38silvansetmessages: + msg8784
2019-05-14 17:34:33maltesetmessages: + msg8783
2019-05-14 15:37:32silvansetmessages: + msg8782
2019-05-14 10:46:43silvansetmessages: + msg8781
2019-05-13 16:02:00maltesetmessages: + msg8779
2019-05-13 14:58:51silvansetmessages: + msg8776
2019-05-08 14:46:06silvansetmessages: + msg8774
2019-05-08 12:11:52maltesetmessages: + msg8773
2019-05-08 09:12:21silvansetstatus: unread -> reviewing
nosy: + malte, jendrik
messages: + msg8771
2019-05-07 19:08:59silvancreate