Forum Jump

Select Group :
Select Forum :
Sorted By :
Sort Order :
From The :
 
 
Thread Tools  Search this thread 
timminn
Total Points: 805
Status Points: 305
Brown Belt
September 5, 2008 2:39 PM PDT
Suggesting an Alternative Output Format
For all your best interest, both the judges and the programmers, I would like to suggest an alternative output format here.
Why do I think the original dots presentation not so good?

Compare to the number of grids on the whole checkerboard, the number of possible Knights and Queens are relatively VERY SMALL. And the empty grids are implied to be "default" and provide no useful information for the solution at all. Hence the output dots which represent the empty grids somehow seem to be wastes. In addition, I think the judges are going to use some program to examine the output, instead of using their EYES ONLY to watch the graphic-like text file. Thus the dots contribute nothing.

An alternative format:

I suggest another format to list all the positions of Knights and Queens using the number of row and columns as it follows(for one solution only):

Queens:
#row1 #column1
#row2 #column2
#row3 #column3
...
Knights:
#row1 #column1
#row2 #column2
#row3 #column3
...
 
The first solution of the given output can be presented as:
Queen:
0 1
1 6
2 2
3 5
4 7
Knight:
5 0
6 0
6 3
6 4
7 3
 
It does not matter if some of the Queens and Knights interleave on the checkerboard
- in this case we can output all the Queens in a sequential manner and then all the Knights.

This format uses less charactors and reduces the output file size to make the IO more efficient, both write(for solving) and read(for judging). The benifit will become significant when N becomes big, i.e. when N is larger than 20.

dgeld
Total Points: 3240
Status Points: 2740
Brown Belt
September 5, 2008 4:45 PM PDT
Rate
 
#1
Another shorter output format will be to output an MD5 hash of the sorted board results

My 11x11 result file is 41MB long but its hash is only 32 characters:
49f9a698f7ae3acc3ad62f5f05b0f372

I use this hash to test non regression of my code. But writing MB of data fast is part of the exercise.

At the moment, my algorithm is not fast enough, the writing represents 0.1 percent of the total runtime. So, no need to use a shorter format.

The proposed grid format is easier to view and helpful to debug your code.

Could you confirm that you obtain the same results as me ?

Thanks.

David.
timminn
Total Points: 805
Status Points: 305
Brown Belt
September 5, 2008 5:02 PM PDT
Rate
 
#2 Reply to #1

Sorry, I am still writing the code, even have not started compiling or debugging.

And, as some released result demostrate, the number of solution explodes, so does the time consumption to explore all the possible solution. I wonder whether the judges will use some N as large as 100 for tests. [actually I think any N>=20 will take some unacceptable time to get a full answer, even with the best optimised parallel algorithm].

petert@dcn.nord.nw.ru
Total Points: 2900
Status Points: 2400
Brown Belt
September 6, 2008 1:02 PM PDT
Rate
 
#3
I think that changing data format to this one would be a good idea, although it would be a bit more difficult to write it efficiently on disk.
Clay Breshears (Intel)
Total Points: 7247
Status Points: 7247
Black Belt
September 9, 2008 4:58 PM PDT
Rate
 
#4 Reply to #3

It was expected that the I/O would again be a very small fraction of the execution time, so the given output format was formulated to make judging a little easier. Upon further consideration, the output format proposed in the this thread should be easily convertible to the stated output format.  Even more compact would be putting each piece on a consecutive lines with a blank between each board, like:

Q: (4 8) (5 6) (6 3) (7 7) (8 2)
N: (1 4) (2 1) (2 4) (2 5) (3 1)
 
Q: (3 8) (5 2) (6 7) (7 3) (8 6)
N: (1 1) (1 4) (1 5) (2 1) (2 4)

The MD5 hash is getting a bit too condensed.  If a code doesn't get the expected hash, we still need to go in and look to see which boards are incorrect.  (Of course, you are all excellent coders and won't get the wrong answers, so this point should be moot, right? Smiley with tongue out [:-P]

What if the output format were made optional (either the original version or some condensed format)? In order to do this, there would be a requirement to explain how the condensed form maps into the original format (and it might require an additional utility be coded and included in the entry to take your output format and produce the original board output).  Would there be any objections to amending the contest problem with something like this?

Unanimous approval by the judges will be required before such a change would be made official.  It is early enough in the month that allowing such an alternative output format shouldn't adversely impact anyone's work to this point. (There may be some contestants getting their code done early for a skiing trip to the Alps, so such a change to the problem would need to be made optional. smiley [:-)])

--clay

dgeld
Total Points: 3240
Status Points: 2740
Brown Belt
September 10, 2008 12:41 AM PDT
Rate
 
#5 Reply to #4
Hello Clay,

madcpbreshe:

It was expected that the I/O would again be a very small fraction of the execution time,



My timing with I/O :
8: 0.0067
9: 0.053
10: 0.346
11: 7.389
12: 51.316

for N>10 we got lot of solutions so the IO is important for the 11 and 12 cases.

timing without IO
8: 0.0063
9: 0.052993
10: 0.343341
11: 6.76894
12: 50.2979

This code is serial so the 11 case will be problematic when going parallel. And more if someone another order of magnitude speedup.

madcpbreshe:
There may be some contestants getting their code done early for a skiing trip to the Alps, so such a change to the problem would need to be made optional.


PS: no snow yet in the Alps but good wind, less tourist -> good conditions for windsurfing :-)
dgeld
Total Points: 3240
Status Points: 2740
Brown Belt
September 10, 2008 1:23 AM PDT
Rate
 
#6 Reply to #4
madcpbreshe:
Q: (4 8) (5 6) (6 3) (7 7) (8 2)
N: (1 4) (2 1) (2 4) (2 5) (3 1)
 
Q: (3 8) (5 2) (6 7) (7 3) (8 6)
N: (1 1) (1 4) (1 5) (2 1) (2 4)



Take 11x11 example (7 queens and knights), outputting a board with the original format is
11 * 12 + 1 = 133 characters

The proposed format takes at least 6 characters per element
(7+7) * 6 = 84

But personal condensed format with an utility to uncondense will be a good idea.

David.
pradiptaghosh
September 10, 2008 8:44 AM PDT
Rate
 
#7 Reply to #1

hi all

please tell me the standard out put format and points format(with bonus points) also.......... and is it possible to resubmit the code???

 

wychen
September 10, 2008 8:55 AM PDT
Rate
 
#8 Reply to #7
pradiptaghosh:

hi all


please tell me the standard out put format and points format(with bonus points) also.......... and is it possible to resubmit the code???


 


First of all, welcome to this contest!
I guess the output format is unchanged until the judge allows the alternative format proposed in this thread. Clay would have the final word on this.
As for the points format (you mean scoring criteria, right?), you can find these information in this forum. Judges post the criteria for each month after they announce the winner.
You are free to resubmit the code before the deadline.
dweeberlyloom
Total Points: 5455
Status Points: 4955
Brown Belt
September 10, 2008 12:33 PM PDT
Rate
 
#9 Reply to #8
It seems to me that it would be pretty easy to add a command line switch that would produce alternate formats, that way people could test using whatever pleases them and the judges could still get the "default" format that is easiest for them to check.
dgeld
Total Points: 3240
Status Points: 2740
Brown Belt
September 10, 2008 12:49 PM PDT
Rate
 
#10 Reply to #9
DweeberlyLoom:
It seems to me that it would be pretty easy to add a command line switch that would produce alternate formats, that way people could test using whatever pleases them and the judges could still get the "default" format that is easiest for them to check.


But someone could use a different execution path when using the command line switch and the judge then would not be able that the solving timing is the same as the one with the "default" output format.

So timing with the custom output format and having an external tool to convert it to "default" is a good alternative.

But once again, I/O (relatively) time is small except for the 11x11 case.

dweeberlyloom
Total Points: 5455
Status Points: 4955
Brown Belt
September 10, 2008 2:31 PM PDT
Rate
 
#11 Reply to #10

Huh!?

I was suggesting that everyone support the requested format for judging (so everything is judged on the same basis).  However, if folks want to use a different format when testing, it would be easy for each of us to support that we prefer with a simple command line switch.

petert@dcn.nord.nw.ru
Total Points: 2900
Status Points: 2400
Brown Belt
September 10, 2008 2:36 PM PDT
Rate
 
#12 Reply to #10

dgeld:
But someone could use a different execution path when using the command line switch and the judge then would not be able that the solving timing is the same as the one with the "default" output format. So timing with the custom output format and having an external tool to convert it to "default" is a good alternative. But once again, I/O (relatively) time is small except for the 11x11 case.

I think that it is worth to require that the program should behave identically with both output formats.

mgarlanger
Total Points: 4220
Status Points: 3720
Brown Belt
September 10, 2008 7:02 PM PDT
Rate
 
#13 Reply to #4
I think it would be useful to have a format of that has each board on a separate line. It could be like the sample without the newlines for each row, or it could be something like FEN: http://en.wikipedia.org/wiki/Board_representation_(chess)

Mark
Clay Breshears (Intel)
Total Points: 7247
Status Points: 7247
Black Belt
September 11, 2008 7:04 PM PDT
Rate
 
#14 Reply to #13

Use of an alternate format is approved.  Details should be in a modified version of the problem description.  We had also put a copy of the details inthe forum, under a new heading.  But I don't see it here.  I'll repost that tomorrow.

--clay

timminn
Total Points: 805
Status Points: 305
Brown Belt
September 11, 2008 9:58 PM PDT
Rate
 
#15 Reply to #4

why do we need the brackets? commas or other single interpunction will separate the pairs well.

madcpbreshe:

It was expected that the I/O would again be a very small fraction of the execution time, so the given output format was formulated to make judging a little easier. Upon further consideration, the output format proposed in the this thread should be easily convertible to the stated output format.  Even more compact would be putting each piece on a consecutive lines with a blank between each board, like:

Q: (4 8) (5 6) (6 3) (7 7) (8 2)
N: (1 4) (2 1) (2 4) (2 5) (3 1)
 
Q: (3 8) (5 2) (6 7) (7 3) (8 6)
N: (1 1) (1 4) (1 5) (2 1) (2 4)

The MD5 hash is getting a bit too condensed.  If a code doesn't get the expected hash, we still need to go in and look to see which boards are incorrect.  (Of course, you are all excellent coders and won't get the wrong answers, so this point should be moot, right? Smiley with tongue out [:-P]

What if the output format were made optional (either the original version or some condensed format)? In order to do this, there would be a requirement to explain how the condensed form maps into the original format (and it might require an additional utility be coded and included in the entry to take your output format and produce the original board output).  Would there be any objections to amending the contest problem with something like this?

Unanimous approval by the judges will be required before such a change would be made official.  It is early enough in the month that allowing such an alternative output format shouldn't adversely impact anyone's work to this point. (There may be some contestants getting their code done early for a skiing trip to the Alps, so such a change to the problem would need to be made optional. smiley [:-)])

--clay

Clay Breshears (Intel)
Total Points: 7247
Status Points: 7247
Black Belt
September 15, 2008 8:21 AM PDT
Rate
 
#16 Reply to #15
timminn:

why do we need the brackets? commas or other single interpunction will separate the pairs well.

You don't need brackets or commas or any other punctuation.  The format  and separator character is up to you.  I was just giving an example. 

In fact, during my shower last night, I had an idea about using something similar to a dictionary-based compression algorithm.  For the two boards in my previous post, I would have printed them as:

3N4N2NN3N14Q5Q4Q11Q2Q6

N2NN3N2N11Q9Q12Q3Q10Q2

 

Place the rows of the board one after the other as a 1-D array.  Count the blank squares between pieces and write down the number.  Pieces are represented by their single letter. I guess I could have used a '.' after each number to make the number a multiplier.

This compression scheme would be so much easier to grade with a sort and a diff.  We might have to write our own utility to convert the board outputs into this format. (I seem to have quite a few good ideas in the shower.  Maybe if I took more I'd be smarter, or least seem that way.)

--clay

dgeld
Total Points: 3240
Status Points: 2740
Brown Belt
September 15, 2008 8:34 AM PDT
Rate
 
#17 Reply to #16
Hello Clay,

guess what, I used a format similar to this one in my yesterday's submission ... I called it RLE (Run Length Encoding).


Q....

..Q..

.....

.....

.N.N.


which then gives
Q6QDN1N1

For simpler implementation, I use only one hexadecimal number to encode spaces and then sums them up.

The one liner format is also easy to grade with sort and diff.

I have written an out2dat perl script (posted in another thread) to transform/sort a QNboardxx.out file to a one liner file which I use in my test suite.

David.

Forum Statistics

4474 users have contributed to 24001 threads and 69861 posts to date.
In the past 24 hours, we have 42 new thread(s) 152 new posts(s), and 197 new user(s).

In the past 3 days, the most popular thread for everyone has been Catastrophic error The most posts were made to Getting Started in the Partner Program The post with the most views is You can report them here if

Please welcome our newest member Udaysimha Mysore (Intel)