Problem 244
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
In particular don't post any code fragments or results.
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
-
dnovatchev
- Posts: 5
- Joined: Fri Jan 16, 2009 6:44 am
Problem 244
The definition of the problem includes the following phraze:
"Now, starting from configuration (S), find all shortest ways to reach configuration (T)."
It is not clear what exactly is meant by "all shortest ways". I have found at least two possible interpretations:
1. From all solutions select only those, whose length is N, where N is the minimum of the lengths of all solutions.
2. Use all different solution paths, such that each intermediate position on the path is visited exactly once (eliminate paths containing loops)
Using definition 1. above I have implemented a solution, [snip], but its checksum is not the expected answer.
Could someone, please, provide the exact correct interpretation of the quoted phraze?
Thanks,
Dimitre
"Now, starting from configuration (S), find all shortest ways to reach configuration (T)."
It is not clear what exactly is meant by "all shortest ways". I have found at least two possible interpretations:
1. From all solutions select only those, whose length is N, where N is the minimum of the lengths of all solutions.
2. Use all different solution paths, such that each intermediate position on the path is visited exactly once (eliminate paths containing loops)
Using definition 1. above I have implemented a solution, [snip], but its checksum is not the expected answer.
Could someone, please, provide the exact correct interpretation of the quoted phraze?
Thanks,
Dimitre
-
dnovatchev
- Posts: 5
- Joined: Fri Jan 16, 2009 6:44 am
Re: Problem 244
I have solved the problem -- it was elsewhere: I was check-summing the reverse of the solution.
-
quilan
- Posts: 182
- Joined: Fri Aug 03, 2007 11:08 pm
Re: Problem 244
Well, you've already finished the problem so you know the solution, but if that sort of wording comes up in the future the intent was, I'm sure, the first; all the checksums of solutions of length N (where N is the minimum length).
ex ~100%'er... until the gf came along.


-
harryh
- Posts: 2091
- Joined: Tue Aug 22, 2006 9:33 pm
- Location: Thessaloniki, Greece
Re: Problem 244
A few words were snipped from the first post, so as not to spoil the problem for others. 
-
elr
- Posts: 67
- Joined: Thu Apr 09, 2009 9:47 am
Re: Problem 244
i kinda got stuck here,i have found a solution which appear to be minimal with path length of 47(or 46)
however whats make the situation wierd is that if i eliminate cycles and already seen boards i find only
one solution,and if i wont there are just too many solutions and the problem cant be solved in 1 minute
however whats make the situation wierd is that if i eliminate cycles and already seen boards i find only
one solution,and if i wont there are just too many solutions and the problem cant be solved in 1 minute

-
quilan
- Posts: 182
- Joined: Fri Aug 03, 2007 11:08 pm
Re: Problem 244
Well, if you think of it, a cycle of more than one node can NEVER provide the minimal path.elr wrote:i kinda got stuck here,i have found a solution which appear to be minimal with path length of 47(or 46)
however whats make the situation wierd is that if i eliminate cycles and already seen boards i find only
one solution,and if i wont there are just too many solutions and the problem cant be solved in 1 minute
Ex:
A -> [B -> C -> D -> B] -> E
will always be longer than
A -> B -> E
So yeah, pro-tip: don't allow cycles.
ex ~100%'er... until the gf came along.


-
elr
- Posts: 67
- Joined: Thu Apr 09, 2009 9:47 am
Re: Problem 244
well what i tried so far is :
my algorithm is iterative deep first search (that increase deep per iteration,so i am sure what i got is the minimal
path)
1)if i disallow cycles + disallow exploring states that already been seen and does not lead to a solution i find only 1
solution
2)if i allow to explore states that already seen but they not a cycle the algorithm can run for hours without completing
(its find many solutions,but it doesnt stop (tested for 7 hours))
if i go with way 1 i get one solution only which is not the answer ,if i go with way 2 there is no way i finish it in 1 minute
my algorithm is iterative deep first search (that increase deep per iteration,so i am sure what i got is the minimal
path)
1)if i disallow cycles + disallow exploring states that already been seen and does not lead to a solution i find only 1
solution
2)if i allow to explore states that already seen but they not a cycle the algorithm can run for hours without completing
(its find many solutions,but it doesnt stop (tested for 7 hours))
if i go with way 1 i get one solution only which is not the answer ,if i go with way 2 there is no way i finish it in 1 minute

- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: Problem 244
I would recommend a breadth-first search for finding shortest paths.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
-
elr
- Posts: 67
- Joined: Thu Apr 09, 2009 9:47 am
Re: Problem 244
BFS would find the shortest path for sure however its would require alot of memory
while as far as i know depth limited search where the limit increase per failed iteration
(so called iterative deeping search) would perform the same as BFS however its would
require much less memory (since no OPEN/CLOSE lists are managed)
while as far as i know depth limited search where the limit increase per failed iteration
(so called iterative deeping search) would perform the same as BFS however its would
require much less memory (since no OPEN/CLOSE lists are managed)

- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: Problem 244
Not here. There aren't many states.elr wrote:BFS would find the shortest path for sure however it would require a lot of memory
I think the performance would be significantly worse. If your IDDFS fails for limit n, you have to re-trace all those paths for limit n+1 and so on.while as far as i know depth limited search where the limit increase per failed iteration
(so called iterative deeping search) would perform the same as BFS
Since we don't have a tree here but a graph with cycles, that could (and I think here it would) be a lot of repeated work, you can reach many states by several paths of (approximately) the same length (e.g. LU and UL; UU, LURU, LUUR, and ULUR), the children of such states would be visited multiple times in each iteration.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.