Issue167

Title FF Heuristic is not Deterministic
Priority feature Status resolved
Superseder Nosy List erez, malte
Assigned To erez Keywords
Optional summary

Created on 2010-12-19.14:08:50 by erez, last changed by malte.

Messages
msg911 (view) Author: malte Date: 2010-12-20.22:57:22
Merged. I only made a small change to make the comparison function local to the
module and take const pointers.

Thanks for spotting and fixing this!
msg908 (view) Author: erez Date: 2010-12-20.13:15:06
In that case, it's already in my repository
msg907 (view) Author: malte Date: 2010-12-20.12:40:05
> But also, I don't think I can use operator<, since I'm sorting a vector of 
> Proposition*, and I don't think I can override the comparison of pointers.
> Or am I missing something?

No, you're right; I didn't see that. Even if you could override that, it'd be a
bad idea. ;-) So separate comparison function is fine.
msg906 (view) Author: erez Date: 2010-12-20.09:55:37
Ignore my last, hash_unary_operator is for hashing a vector.
But also, I don't think I can use operator<, since I'm sorting a vector of 
Proposition*, and I don't think I can override the comparison of pointers.
Or am I missing something?
msg905 (view) Author: erez Date: 2010-12-20.09:13:09
Should I also do this of the hash function (hash_unary_operator)?
msg902 (view) Author: malte Date: 2010-12-19.16:11:10
PS: Better to define operator< than use a separate comparison method.
msg901 (view) Author: malte Date: 2010-12-19.16:07:26
Looks good. Can you prepare an issue167 branch?
msg900 (view) Author: erez Date: 2010-12-19.15:16:57
I think I found the culprit.
Line 132 in relaxation heuristic.cc:
sort(op.precondition.begin(), op.precondition.end())

When I add this:
static bool compare_props(const Proposition *p1, const Proposition *p2) {
    return p1->id < p2->id;
}
and change the line to
sort(op.precondition.begin(), op.precondition.end(), compare_props);

It seems to make FF deterministic.
msg899 (view) Author: erez Date: 2010-12-19.14:08:49
The FF heuristic's implementation is not deterministic, and depends on other 
things going on in memory.
Example:
For depot:pfile18, running    ./downward --heuristic "h=ff()" --search 
"eager_greedy(h,preferred=(h))" gives an initial h value of 65.

Running  ./downward --landmarks "lmg=lm_rhw()" --heuristic "h=ff()" --search 
"eager_greedy(h,preferred=(h))" < output  (which does the same except for 
creating a landmarks graph first) gives an initial h-value of 63 or 64

I think this is because somewhere, some hash is based on memory addresses (even 
though I noticed an attempt to get rid of this in hash_unary_operator).
History
Date User Action Args
2010-12-20 22:57:22maltesetstatus: reviewing -> resolved
assignedto: erez
messages: + msg911
2010-12-20 13:15:06erezsetstatus: chatting -> reviewing
messages: + msg908
2010-12-20 12:40:05maltesetmessages: + msg907
2010-12-20 09:55:37erezsetmessages: + msg906
2010-12-20 09:13:09erezsetmessages: + msg905
2010-12-19 16:11:10maltesetmessages: + msg902
2010-12-19 16:07:26maltesetmessages: + msg901
2010-12-19 15:16:57erezsetmessages: + msg900
2010-12-19 14:08:50erezcreate