Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MATLAB Programming Contest: May 9 - May 16, 2007

16 views
Skip to first unread message

Helen Chen

unread,
Apr 26, 2007, 6:39:05 PM4/26/07
to
Hello Community!

This is just a quick message to let everyone know that the MATLAB
Contest Masters have been hard at work! They have been crafting a
really exciting new challenge for our Spring event with some very
cool prizes waiting for our champions.

It's time to clear your calendars so that you can come join the fun!
The contest will start at noon Eastern time on May 9, ending at noon
on Mary 16th.

We will be announcing more details about the contest as we get
closer, so if you want a refresher about MATLAB Central contests,
check out the contest overview page at <http://www.mathworks.com/contest/overview.html>.
ou can checkout past contests using links on that page.

Stay tuned for more information...

Best wishes,
Helen Chen
MATLAB Central Team

Matthew Simoneau

unread,
May 9, 2007, 9:29:02 AM5/9/07
to
Our contest will indeed begin today at noon EDT. I posted a welcome
message to the contest blog with some new information:

<http://blogs.mathworks.com/contest/>

We have a few channels for contest conversation. This newsgroup
thread is the best place for general discussion. If you have a
response to anything we post on the blog, we encourage you to leave a
comment on the blog itself. Finally, if you'd like to communicate
with the contest team privately, e-mail us at con...@mathworks.com.

Good luck to everyone!

Alan Chalker

unread,
May 9, 2007, 12:28:44 PM5/9/07
to
Thanks for organizing another contest. I'm looking forward to
participating as I'm sure a lot of people are.

Maybe this is in the code package, which I haven't looked at yet, but
what is the formula for the final result? In the past you've always
outlined it as something like

result = a*score + b*e^(c*time)

However with the new cyclomatic complexity variable it'd be helpful
to understand how that factors into the result.

Mike Bindschadler

unread,
May 9, 2007, 12:53:37 PM5/9/07
to
The contest problem looks pretty interesting, thanks for setting it
up!

I tried to run the solitaireGUI.m function which came with zipped
contest files, and got an error message as follows:

Warning: Divide by zero.
> In solitaireGUI at 63
??? Undefined command/function 'bsxfun'.

Error in ==> solitaireGUI>drawGUI at 200
c = c(:,~(sum(bsxfun(mf,1:size(c,2),(1:size(c,2))'))>1))';

Error in ==> solitaireGUI at 69
[hf,ha,sh,ht,hl] = drawGUI; printStats

I'm running MATLAB 7.1 student edition.

John D'Errico

unread,
May 9, 2007, 12:58:47 PM5/9/07
to
bsxfun only came out in the most recent release.

John

Matthew Simoneau

unread,
May 9, 2007, 1:07:45 PM5/9/07
to
Hi Alan,

I added the scoring formula to the rules. It is the same as it was
before with k*complexity added on the end.

Thanks,
Matthew

Windy Miller

unread,
May 9, 2007, 1:08:13 PM5/9/07
to
I'm just trying to run "runcontest", to see what the basic unmodified
solver does to the testsuite. I have a choice of error messages...

>> runcontest
??? Too many inputs.

Error in ==> runcontest at 18
solutions = cellfun(@solver,boards,'UniformOutput',false);

>> runcontest(true)
??? Function name must be a string.

Error in ==> solitaireGUI>drawGUI at 184
ht = cellfun(@(f,p) uicontrol('Sty','Tex','Fore',f,'Back',[1 1
.83],...

Error in ==> solitaireGUI at 69
[hf,ha,sh,ht,hl] = drawGUI; printStats

Error in ==> runcontest at 27

solitaireGUI(testsuite(i).board,solution,min(1,5/size(solution,1)))

>>

(MATLAB version 7.0.1)

Any ideas?

Lucio

unread,
May 9, 2007, 1:17:53 PM5/9/07
to
This may also be due to the fact that we used 7.4.0 to create the
GUI, we will provide a backwards compatible version soon. Please bare
with us.

Lucio

Markus

unread,
May 9, 2007, 1:29:06 PM5/9/07
to
Hi!

I am having the same problem with the bsxfun error message, as I am
running R2006a. The contest team did a good job in obfuscation, or
what do you think about these lines?

% mf = @(g,h) arrayfun(@(h)
all(inpolygon(c{1,g},c{2,g},c{1,h},c{2,h})),h);
% c = c(:,~(sum(bsxfun(mf,1:size(c,2),(1:size(c,2))'))>1))';

This source couldn't be easier to read I guess :-)

A good contest to all of you!

Markus

Alan Chalker

unread,
May 9, 2007, 1:38:21 PM5/9/07
to

It's not deliberate obscufation that I can tell. The first line is
setting up an nested anonymous function handle (search for anonymous
functions in the MATLAB help for info). bsxfun is a new one to me,
but it applies element by element binary operations to 2 arrays.

The bottom line is they have used some of the more advanced
functionality to setup a demo solver and runcontest program that is
vectorized versus containing a lot of loops. This also factors into
the new Complexity rating.

Kudos to them for setting the bar high on this contest by trying to
start us off on a vectorized path instead of the 'easier to follow'
looping path many people would prefer to take.

Lucio

unread,
May 9, 2007, 1:44:58 PM5/9/07
to
OK to run in 7.1 change the following lines, sorry for the wrapping,
we will update the zip file and investigate further the other Windy's
problem (Windy, what release are you using?)

% c = c(:,~(sum(bsxfun(mf,1:size(c,2),(1:size(c,2))'))>1))';

CHANGE TO:

MF = zeros(size(c,2));
for i1 = 1:size(c,2)
for i2 = 1:size(c,2)
MF(i1,i2) = mf(i1,i2);
end
end
c = c(:,~sum(MF)>1)';

% patch(bsxfun(@plus,j(:)',.1*sin(-2*pi:pi/4:2*pi)'),...
% bsxfun(@plus,i(:)',.1*cos(-2*pi:pi/4:2*pi)'),...
% zeros(17,numel(i)),'faceC',[0 .5 0],'FaceL','none');

CHANGE TO:

patch(repmat(j(:)',17,1)+repmat(.1*sin(-2*pi:pi/4:2*pi)',1,numel(j)),.
..

repmat(i(:)',17,1)+repmat(.1*cos(-2*pi:pi/4:2*pi)',1,numel(i)),...
zeros(17,numel(i)),'faceC',[0 .5 0],'FaceL','none');

Lucio

Marko

unread,
May 9, 2007, 2:58:55 PM5/9/07
to
Can somebody explain me this line in the grade.m function?

if tb(f) && board(f(2),f(1))>0 % valid pick

why isn't board(f(1),f(2)) checked? Do I have to read the contest
rules more carefully?

Alan Chalker

unread,
May 9, 2007, 3:10:19 PM5/9/07
to
Contest team:

There is an error in the grade function, but I haven't been able to
figure it out yet.

Try to run the examples in the rules like this:

grade([7 0 2 0; 0 0 8 0; 0 7 0 0; 0 0 3 4], [1,3,3,3])
result = 31
according to the rules it should be 25

likewise

grade([7 0 2 0; 0 0 8 0; 0 7 0 0; 0 0 3
4],[4,4,4,2;4,2,2,2;2,2,2,4]);
result = 35
according to the rules it should be 17

I only discovered this because as I was testing things that should
work out, my score was going up, not down.

pete torrione

unread,
May 9, 2007, 3:10:59 PM5/9/07
to

I have the same question. This seems odd:

board = [1 5 0];
score = grade(board,[1 1 1 3])
gives 7 (because the jump is invalid)

but
score = grade(board,[1 1 3 1])
gives 2; the expected score, i thought...

Jan Langer

unread,
May 9, 2007, 3:11:27 PM5/9/07
to

I have also big problems with the grade function.
Jan

Marko

unread,
May 9, 2007, 3:13:17 PM5/9/07
to
All indices of type x(2),x(1) must be x(1),x(2) i think

Nick Howe

unread,
May 9, 2007, 3:14:37 PM5/9/07
to
Thanks once again to everybody at the Mathworks who works hard to
bring us a fun contest. I have a question concerning a possible
discrepancy in the starter files. The solver provided seems to
generate moves which the grade.m function considers invalid. In
looking into the matter, it appears that the expected order of
indices is swapped. So for example, the first set of commands will
generate a poorer score than the second:

moves = solver(board)
grade(moves)

moves = solver(board)
grade(moves(:,[2 1 4 3]))

Of course, runcontest does the former. So should we write our
solvers accordingly?

Peter Torrione

unread,
May 9, 2007, 3:18:22 PM5/9/07
to
Marko wrote:
> All indices of type x(2),x(1) must be x(1),x(2) i think
It looks like doing this at the end of your 'solver' solves the problem:

moves = moves(:,[2 1 4 3]);

Marko

unread,
May 9, 2007, 3:27:49 PM5/9/07
to
Peter Torrione wrote:

> It looks like doing this at the end of your 'solver' solves the
> problem:
>
> moves = moves(:,[2 1 4 3]);

Yes but it's not supposed to work like that and confusing shifting
from row,colum indices to colum,row

Maybe I should stop solving and start evaluating again :-)

Lucio

unread,
May 9, 2007, 3:32:17 PM5/9/07
to
Peter is correct, the indexes got messed up when we set the grade.m
function from the GUI. Changing the lines

f = moves(i,[1 2]);
t = moves(i,[3 4]);

to

f = moves(i,[2 1]);
t = moves(i,[4 3]);

should be enough, albeit I will carefully revise it, when done we'll
update the zip file. Sorry for the inconvenience.

Lucio

Sergey Yurgenson

unread,
May 9, 2007, 3:33:21 PM5/9/07
to
I guess it should be changed in grade.m:

f = moves(i,[2 1]);
t = moves(i,[4 3]);

then there will be consistency between grade.m and solitaireGUI.m

Peter Torrione

unread,
May 9, 2007, 3:34:40 PM5/9/07
to
Marko wrote:
> Peter Torrione wrote:
>
>> It looks like doing this at the end of your 'solver' solves the
>> problem:
>>
>> moves = moves(:,[2 1 4 3]);
>
> Yes but it's not supposed to work like that and confusing shifting
> from row,colum indices to colum,row
>
I agree. Plus the gui becomes useless...

Sergey Yurgenson

unread,
May 9, 2007, 3:39:34 PM5/9/07
to
Sorry for repeat. Did not see Lucio’s response.

Peter Torrione

unread,
May 9, 2007, 3:40:33 PM5/9/07
to
Hi.

According to the web page, there is a 180 second time limit on our
programs. Is that for each board? How many boards will the programs be
expected to solve in 180 seconds?

-pete

Lucio

unread,
May 9, 2007, 3:49:09 PM5/9/07
to
Pete:

As usual, the testsuite sample that we provide has the
same level of complexity as the hidden testsuite. 180 seconds is the
time given to solve the whole testsuite.

Lucio

Alan Chalker

unread,
May 9, 2007, 3:56:27 PM5/9/07
to

I assume this error exists on the actual contest machine too. Are
you going to re-run all the entries submitted so far to get correct
scores?

Matthew Simoneau

unread,
May 9, 2007, 4:43:02 PM5/9/07
to
We've updated the File Exchange download to include a version of the
GUI that will run on older versions of MATLAB, solitareGUIb.m. We've
also made the fix to grade.m.

This same code was used on the scoring machine. We've updated
grade.m there as well. One of the reasons that we the administrators
like starting the contest in darkness is that we can patch up any
last-minute discoveries before it affects the game.

Lucio dreams in MATLAB code, so please forgive its terseness. He was
also a contest participant before he was an employee. Have y'all
checked out our list of job openings? We're hiring!

Thanks everyone for your patience.

Alan Chalker

unread,
May 9, 2007, 5:16:59 PM5/9/07
to
I'm not sure you fixed grade.m. I manually did the fix outlined
above and everything was working fine. Then I just downloaded the
new version and it's giving high scores again. Looking at the file
you didn't switch the indexes you just switched the f = moves... and
t=moves... lines positions.

Leendert Combee

unread,
May 9, 2007, 5:21:17 PM5/9/07
to
Matthew Simoneau wrote:
>
>
> We've updated the File Exchange download to include a version of
> the

Great, for all those (like me) that are on much older versions
without anonymous functions (the @), they are easy to replace by
ordinary functions. NB, does the complexity of an anonymous functions
add to the cyclomatic complexity of the function they are defined in?


Also I was suprised that the peg values are not integers but all
kinds of floats? Is that correct?

Otherwise a fun puzzle indeed!

Matthew Simoneau

unread,
May 9, 2007, 5:27:26 PM5/9/07
to
Alan, you're right. I didn't read Lucio's instructions carefully
enough. The re-corrected version will be live shortly.

Gerbert Myburgh

unread,
May 9, 2007, 6:02:48 PM5/9/07
to
Matthew Simoneau wrote:
>
>
> Alan, you're right. I didn't read Lucio's instructions carefully
> enough. The re-corrected version will be live shortly.

Damn...

I've been double checking my code for the last two hours.
Couldn't figure out why on earth every change I make keeps on
increasing my score.

Thanks for pointing out the fix guys.

Mike Gallamore

unread,
May 9, 2007, 7:23:00 PM5/9/07
to
Probably so they can pop the number right into the evaluation
function. I'm not sure but I seem to recall PIV and Core 2 Duo's have
more floating point units than integer, good chance it could improve
performance (at least on compiled code :( )

peter torrione

unread,
May 9, 2007, 7:59:44 PM5/9/07
to
I just downloaded the new score.m - last modified at 5:22 pm, is
something odd about:

>> board = [1 5 0];

>> moves = [1 1 1 3];
>> score = grade(board,moves)

score =

6

?

I thought score should be 2...

Richard Brown

unread,
May 9, 2007, 8:14:39 PM5/9/07
to
Are we allowed to use try ... catch constructs?

On May 10, 1:29 am, "Matthew Simoneau" <matt...@mathworks.com> wrote:
> Our contest will indeed begin today at noon EDT. I posted a welcome
> message to the contest blog with some new information:


Matthew Simoneau

unread,
May 9, 2007, 8:24:25 PM5/9/07
to
Peter, I seem to be too sleepy for this! I still had it wrong in
grade.m. I'm updating it again. Please copy Lucio's fix above more
carefully than I did!

Richard, there's no problem with try/catch, but you're not allowed to
call ERROR explicitly.

Abhi

unread,
May 10, 2007, 5:47:57 AM5/10/07
to
Hi,

I'm using MATLAB Version 7.3.0.267 (R2006b).

Still getting error in GUI :
Undefined function or method 'bsxfun' for input arguments of type
'function_handle'.

How can I use the new GUI: solitaireGUIb.m

Any help?

Rgds,
Abhi

srach

unread,
May 10, 2007, 6:18:24 AM5/10/07
to

Open runcontest.m and change line


solitaireGUI(testsuite(i).board,solution,min(1,5/size(solution,1)))

to


solitaireGUIb(testsuite(i).board,solution,min(1,5/size(solution,1)))

srach

Abhi

unread,
May 10, 2007, 8:56:09 AM5/10/07
to
srach wrote:
>
>
>
> Open runcontest.m and change line
>
>
> solitaireGUI(testsuite(i).board,solution,min(1,5/size(solution,1)))
>
> to
>
>
>
solitaireGUIb(testsuite(i).board,solution,min(1,5/size(solution,1)))
>
>
> srach

Thnxx..that works...

Rgds,
Abhi

Nick Howe

unread,
May 10, 2007, 12:07:55 PM5/10/07
to
There seems to be a discrepancy between the timestamp given on the
page you see after you submit an entry, and the timestamp you get
when you follow the "Entry Listing" link from the contest menu. The
latter seems to lag the former by two minutes or so. At least that's
how it looked to me at the end of Darkness. I submitted a (slightly
late) last-minute entry and the page said 12:01, then clicked the
Entry Listing link and got a page that said 11:59. My most recent
entry wasn't there yet, which sort of makes sense. Is the "Entry
Listing" link a time-delayed view, or are there two clocks? Just
curious. :-)

Matthew Simoneau

unread,
May 10, 2007, 1:19:50 PM5/10/07
to
Hi Nick and welcome back. Most of the pages you see on the contest
site are refreshed only every couple of minutes. (We do this to keep
from having to hit the database every time someone views every page.)
When you see "This page was generated..." on a page, the time
represents when this page was last refreshed, as late as a few
minutes ago, not the current time.

B

unread,
May 10, 2007, 2:16:30 PM5/10/07
to
Is there any possibility of getting this to work on say r12.1? I've
been making modifications to try to get this to happen but im getting
the following error i do not understand?

runcontest
??? Error: File: C:\contest\jumping\solver.m Line: 10 Column: 6
"identifier" expected, "(" found.

Error in ==> C:\contest\jumping\runcontest.m
On line 20 ==> solutions{i} = solver(testsuite(i).board);

which pertains to

s = @(i,j) sub2ind([m,n],i,j);

in solver.m

Does anyone know why this errors? Is this due to my old version of
matlab?

Thanks

Lucio wrote:
>
>
> This may also be due to the fact that we used 7.4.0 to create the
> GUI, we will provide a backwards compatible version soon. Please
> bare
> with us.
>
> Lucio
>
> Windy Miller wrote:
>>
>>
>> I'm just trying to run "runcontest", to see what the basic
>> unmodified
>> solver does to the testsuite. I have a choice of error
> messages...
>>
>>>> runcontest
>> ??? Too many inputs.
>>
>> Error in ==> runcontest at 18
>> solutions = cellfun(@solver,boards,'UniformOutput',false);
>>
>>>> runcontest(true)
>> ??? Function name must be a string.
>>
>> Error in ==> solitaireGUI>drawGUI at 184
>> ht = cellfun(@(f,p) uicontrol('Sty','Tex','Fore',f,'Back',[1 1
>> .83],...
>>
>> Error in ==> solitaireGUI at 69
>> [hf,ha,sh,ht,hl] = drawGUI; printStats
>>
>> Error in ==> runcontest at 27
>>
>>
> solitaireGUI(testsuite(i).board,solution,min(1,5/size(solution,1)))
>>
>>>>
>>
>> (MATLAB version 7.0.1)
>>
>> Any ideas?

Walter Roberson

unread,
May 10, 2007, 2:28:07 PM5/10/07
to
In article <ef552...@webcrossing.raydaftYaTP>,

B <Brian....@hotmail.com> wrote:
>Is there any possibility of getting this to work on say r12.1? I've
>been making modifications to try to get this to happen but im getting
>the following error i do not understand?

>runcontest
>??? Error: File: C:\contest\jumping\solver.m Line: 10 Column: 6
>"identifier" expected, "(" found.

>Error in ==> C:\contest\jumping\runcontest.m
>On line 20 ==> solutions{i} = solver(testsuite(i).board);

>which pertains to

>s = @(i,j) sub2ind([m,n],i,j);

>in solver.m

>Does anyone know why this errors? Is this due to my old version of
>matlab?

Did R12.1 support anonymous functions?
--
"It is important to remember that when it comes to law, computers
never make copies, only human beings make copies. Computers are given
commands, not permission. Only people can be given permission."
-- Brad Templeton

Steven Lord

unread,
May 10, 2007, 4:31:46 PM5/10/07
to

"Walter Roberson" <robe...@ibd.nrc-cnrc.gc.ca> wrote in message
news:f1vo7n$cph$1...@canopus.cc.umanitoba.ca...

> In article <ef552...@webcrossing.raydaftYaTP>,
> B <Brian....@hotmail.com> wrote:
>>Is there any possibility of getting this to work on say r12.1? I've
>>been making modifications to try to get this to happen but im getting
>>the following error i do not understand?
>
>>runcontest
>>??? Error: File: C:\contest\jumping\solver.m Line: 10 Column: 6
>>"identifier" expected, "(" found.
>
>>Error in ==> C:\contest\jumping\runcontest.m
>>On line 20 ==> solutions{i} = solver(testsuite(i).board);
>
>>which pertains to
>
>>s = @(i,j) sub2ind([m,n],i,j);
>
>>in solver.m
>
>>Does anyone know why this errors? Is this due to my old version of
>>matlab?
>
> Did R12.1 support anonymous functions?

No. Anonymous functions were introduced in MATLAB 7.0 (R14). Brian, you
could try converting the anonymous functions into a regular function, but
you'd also need to modify the locations where those anonymous functions are
called to pass in the correct parameters in the correct order.

--
Steve Lord
sl...@mathworks.com


b

unread,
May 10, 2007, 4:57:25 PM5/10/07
to
Perhaps this is a topic for another thread but, im not exactly sure
of what the purpose of using the anonymous function in this case is?

with the statement s=@(i,j) sub2ind([m,n],i,j);
am i just declaring a function S that takes in values i and j and is
simply using the sub2ind function?

when i call the s function in the above case as s(i,j) the value
returned in place of s(i,j) is just the value of sub2ind([m,n],i,j)?

Aside from having multiple script files what is the benefit in this
situation of using the anonymous function?

Thanks,
Brian

Matthew Simoneau

unread,
May 10, 2007, 5:53:08 PM5/10/07
to
Based on a suggestion from a user, I've added the complexity (in
parenthesis) to the results column. This will only show up on
entries processed from now on.

Leendert Combee

unread,
May 10, 2007, 5:59:24 PM5/10/07
to
> with the statement s=@(i,j) sub2ind([m,n],i,j);
> am i just declaring a function S that takes in values i and j and

yes, that's right and all, just a more compact code...

to Walter: just replace s(x,y) in the code by sub2ind([m,n],x,y)
where x and y are the actual arguments used whereever you encounter
s. In grade.m you need to do something similar to t(f)

b

unread,
May 10, 2007, 6:43:43 PM5/10/07
to
Thanks all, I believe I am close to having a package that will
atleast let me try to develop contest solutions. I am curious though
if someone can do me a favor so i can validate my results. Can
someone run the testsuite for say the first 3 boards, and tell me
what the results are when running the test suite unchanged? I'd like
to verify that all of my modifications are still kosher.

b

eigenvector

unread,
May 10, 2007, 8:32:34 PM5/10/07
to
Hi,

I get this error:

Error using ==> filefilt at 123 The function ER...

What does it mean? I am quite puzzled...

Thanks!

Matthew Simoneau

unread,
May 10, 2007, 8:59:05 PM5/10/07
to
> Error using ==> filefilt at 123 The function ER...

The rest of this message is "The function ERROR has been disabled".
ERROR is on our list of blocked functions.

eigenvector

unread,
May 11, 2007, 5:56:58 AM5/11/07
to
Your are right, thanks!

While we are at it, it turns out that ERROR appeared in the function
grade which you supplied and I used. Maybe you want to consider
removing it from grade... :)

Thanks again!

Volkan

unread,
May 11, 2007, 6:11:43 PM5/11/07
to
Hi all,

Does anyone know what the number in paranthesis just below the
Results field is? Does it have anything to do with the submissions
cyclomatic complexity?

the cyclist

unread,
May 11, 2007, 6:37:00 PM5/11/07
to
Yes. It IS the cyclomatic complexity.

Matthew Simoneau

unread,
May 11, 2007, 8:55:08 PM5/11/07
to
the cyclist wrote:
> Yes. It IS the cyclomatic complexity.

Cyclistmatic?

I added "cyc: " in front of the number so everyone will have a chance
of guessing what it means. Someday we'll get this thing its own
column.

Alan Chalker

unread,
May 12, 2007, 2:43:00 AM5/12/07
to
For those of you interested, I've submitted a heavily commented
version of the current leading code under the name "Guided tour of
dreamland" (ID: 39727). It should be help to anyone who wants to
understand exactly how what algorithms the best entries are working
with.

As I put in my comment:

Note in the interest of collaboration I'm documenting the leading
code as much as possible. Instead of going the obscufation route with
this, I invite everyone to document / take credit for their
particular changes as the codes get modified. At a minimum, please
don't remove the existing comments so someone doesn't have to start
from scratch on commenting updated code again

I did put in a small algorithmic tweak to make it a bit faster, which
puts it into 1st place as of 2:30AM, but I definitely can't take
credit for the bulk of the effort, which was developed back and forth
between several other contestants over the course of the day.

I hope this gesture prevents or at least delays the onset of
obscufation that normally happens about now in the contest. Such
obscufation makes it more challenging for new competitors to jump in
and understand what's going on.

Markus

unread,
May 12, 2007, 5:58:02 AM5/12/07
to
Alan Chalker wrote:
> For those of you interested, I've submitted a heavily commented
> version of the current leading code

Great idea Alan! That is really in the spirit of the contest!

Markus

unread,
May 12, 2007, 6:02:13 AM5/12/07
to
To the contest team:

In the last contests we were already crying for inserting a "captcha"
on the entry submit page. Just as I have to fill "BTQNT" in a Word
verfication line below the form where I currently am typing this text
in. This would prevent spamming the queue and searching for the best
parameters by multiple entries.

Did you not include it because you don't like the idea or because you
did not have the resources to do the modification to the interface?

Markus

Helen Chen

unread,
May 12, 2007, 7:21:18 AM5/12/07
to
Hi Markus !

We definitely think think that this is a good idea but unfortunately
do not have the resources to redo the contest site at this time. We
are looking to do something along those lines in the future.

Helen

the cyclist

unread,
May 12, 2007, 9:00:52 AM5/12/07
to
> This is just a quick message to let everyone know that the MATLAB
> Contest Masters have been hard at work!

Looks like there might be some small problems with the statistics
page. The Saturday "Contributions in Daylight" seem to be being
counted in Friday as well. Also, I think some or all of the graphs
on that page are not being updated.

Thanks again for putting on the contest.

Helen Chen

unread,
May 12, 2007, 9:09:33 AM5/12/07
to
Thanks for pointing this out! We'll take a look at this, although
maybe not until Monday.

Helen

Nick Howe

unread,
May 12, 2007, 9:54:12 AM5/12/07
to
I want to credit Jim Mikola's entry Juno39 for providing the grist
for my EarlyBird winner. A number of entries were doing better on
small problems than the current leader at the time, so I decided to
try combining them. I had intended to use my own Darkness solution in
this role (and submitted a few attempts that did so) but the
combination with Jim's solution worked the best. Thanks Jim!

Matthew Simoneau

unread,
May 13, 2007, 9:18:48 AM5/13/07
to
I fixed the bug in the "Contributions in Daylight" section of the
Statistics page that the cyclist noticed. Thanks for letting us know.

Gautam Roy

unread,
May 13, 2007, 10:26:51 AM5/13/07
to
Hi,
I am trying to use Matlab 6.0 R12. I have changed the anonymous
functions s and tb to
%%%% function s
function ret = s(siz,i,j)
ret = sub2ind(siz,i,j);

%%%%% function tb
function p = tb(p,siz)
all([p>0 p<=[siz(2) siz(1)] ~rem(p,1)]);

Is this correct?

Also I received errors on all if statements which use || or && and
that was solved by changing them to | and & respectively.
Have these operators changed in recent versions ?

After this on runcontest I am getting
ans =

results: 130055.0797
time: 0.59

Is this what i am supposed to get?

the cyclist

unread,
May 13, 2007, 11:07:38 AM5/13/07
to
Thanks! The only issue I see right now on the Statistics page is
that the font on the Contest History graph is huge.

Jason Nicholson

unread,
May 13, 2007, 10:29:49 PM5/13/07
to
I have been following the last two contests. I am amazed at the
programming ability of many of the contestants. For a senior
mechanical engineering student, I am good with MATLAB. Compared to
what is going on here, I am not in the same league. How have all of
you become such guru's? How do I become a matlab guru?

Note: I started a new thread on the MATLAB Newsgroup page that you
can reply to this. I only posted this message so that some of the
contestants would see and reply.

the cyclist

unread,
May 14, 2007, 12:55:21 PM5/14/07
to

Continuing to be the watchdog of the Stats page ...

I think the Most Active Participants graph is not being updated.

Alan Chalker

unread,
May 14, 2007, 2:08:25 PM5/14/07
to
For those of you interested, I've posted another heavily commented
version of the leading code as of mid-day today, Monday. The code is
"Guided Tour Part 2" (id: 40979).

Unfortunately, with the number of subfunctions and recursive calls
the code has become much more difficult to understand than in my
previous attempt at this. Hopefully you'll find this of value /
interest.

Matthew Simoneau

unread,
May 14, 2007, 2:24:09 PM5/14/07
to
cyclist, these images seem to be up-to-date on my end. Your browser
may be caching old versions. Try forcing a reload with ctrl-shift-R
or whatever your browser uses.

Markus

unread,
May 14, 2007, 5:07:03 PM5/14/07
to
Hi!

As you have read, I won the Big Sunday Push. I just want to tell you
the interesting story how lucky I were to win this prize.

My contribution markus9 introduced a significant speed improvement to
the part of the code origininating from Yi Cao and his twilight
winning contribution. Actually I had already put this improvement in
an earlier submission called markus8 of 2007-05-12 07:58:42. If I had
not made an algorithmic error when combining some different code
versions, I had probably won the Saturday Early Morning Special (at
2007-05-12 08:00:00) with this contribution.

Well, as markus8 finished somewhere in no man's land, of course no
one took notice of the improvement. So I had the chance to use it in
another attempt. markus9 - now without this f... error - made an
improvement about 8 points. However, looking into the statistics
later that day, I was disappointed that Jan Langer had already
reached a cumulative improvement of more than 10 by numerous tweaking
contributions (when does this guy sleep?!?).

But, to my great surprise, my speed improvement disappeared from the
leading code again over the day! It was Nathan Q who found another,
even larger way to improve the speed. He took the lead with his
submission bigh_L8 at 06:12 h after my submisson markus9 of 05:17 h
(no, I don't work all through the night, I just live in another time
zone). As the other contestants now started working on the code of
the new leader, it happened that I had a third chance to use the same
improvement again. This time the impact was even larger (about 18
points), lifting me up to win the Big Sunday Push.

I'd like to mention the contribution of Nathan Q here again, who
introduced a fast update to the vector of possible moves instead of
completely recomputing it. I guess in the next contests, I may not
hope that Nathan gives me such assistance again in winning a
midcontest prize. :-)

I wish you lots of fun during the remaining time of this contest!

Markus

Markus

unread,
May 14, 2007, 5:12:49 PM5/14/07
to
Hi!

After telling such a long story, I want to make another suggestion
for a small rule change. I think in the 1000 character challenge, all
variable names should be counted as one character, as well as all
subsequent whitespaces. This way no one would need to obfuscate code
by replacing all meaningful variable names to one-character variable
names and to remove all linebreaks and indentation. I think a script
counting this way can be written as fast as a
character-saving-by-obfuscation one.

What do you think?!?

Markus

Leendert Combee

unread,
May 14, 2007, 6:42:22 PM5/14/07
to
Alan Chalker wrote:
>
> Unfortunately, with the number of subfunctions and recursive calls
> the code has become much more difficult to understand than in my
> previous attempt at this. Hopefully you'll find this of value /
> interest.

I wish I could get the code rewritten without nested functions that
seem to inherit and pass on variables without properly included in
the argument lists. I am on an older Matlab version and just can't
get the first method (based on solveri) to work properly, it's making
wrong moves. I have tried twice, but to no avail. D@mn.

the cyclist

unread,
May 14, 2007, 7:53:26 PM5/14/07
to
I tried clearing my cache, and I also tried using IE instead of
Firefox, and I still see the same stale graphs.

Shashi Khatri

unread,
May 15, 2007, 2:57:13 AM5/15/07
to
Has anyone estimated k_1, k_2, k_3 and k_4. It seems like time plays
almost no role in the score!

Isn't the maximum time allowed 180 seconds? How come I'm yet to see
an entry that takes more than 60 seconds?

Thanks people...

Shashi

Markus

unread,
May 15, 2007, 2:59:03 AM5/15/07
to
> I wish I could get the code rewritten without nested functions that
> seem to inherit and pass on variables without properly included in
> the argument lists.

I think the introduction of nested functions to Matlab led to even
more unreadable code. They might be nice to have for a short
three-liner in another function. But excessively used like in the
current contest, they lead to perfect disorientation and mistakes.
You will have to be extremely attentive not to use a variable like i
or m or n that is also used in the parent function, if there are many
nested functions over a large number of lines.

srach

unread,
May 15, 2007, 4:25:31 AM5/15/07
to
Since quite a while I haven't been able to reach the contest site (http://www.mathworks.com/contest/jumping/home.html).
t just diplays a "Page not found" message.

Is this problem related to my internet connection or is the site
down, i.e., does anybody experience the same problem?

Best,
srach

Matthew Simoneau

unread,
May 15, 2007, 4:41:21 AM5/15/07
to
srach, the site is back up.

abdeldjebar

unread,
May 15, 2007, 5:32:45 AM5/15/07
to
Helen Chen wrote:
>
>
> Hello Community!

>
> This is just a quick message to let everyone know that the MATLAB
> Contest Masters have been hard at work! They have been crafting a
> really exciting new challenge for our Spring event with some very
> cool prizes waiting for our champions.
>
> It's time to clear your calendars so that you can come join the
> fun!
> The contest will start at noon Eastern time on May 9, ending at
> noon
> on Mary 16th.
>
> We will be announcing more details about the contest as we get
> closer, so if you want a refresher about MATLAB Central contests,
> check out the contest overview page at <http://www.mathworks.com/contest/overview.html>.
> ou can checkout past contests using links on that page.
>
> Stay tuned for more information...
>
> Best wishes,
> Helen Chen
> MATLAB Central Team

the cyclist

unread,
May 15, 2007, 7:43:06 AM5/15/07
to
Alan Chalker posted the following coefficients in the contest blog:

k1 = 0.1
k2 = 2
k3 = 0.05
k4 = 1

Sergey Yurgenson

unread,
May 15, 2007, 8:01:18 AM5/15/07
to
To Shashi,
In a contrary, I think that at the moment time plays too important
role. It is very easy just to improve result, but time penalty will
be significant. So, collective wisdom tells us that current sweet
spot is around 50 sec.
It resembles the situation with Blockbuster contest. However during
BlackBox contest times played less important role and participants
spent more time optimizing actual logic of algorithm then trying to
shave extra 0.01 sec from running time.
Saying that, I have to admit that it is practically impossible to set
coefficients in advance and create perfect result/time balance

SY

the cyclist

unread,
May 15, 2007, 1:25:48 PM5/15/07
to
Helen Chen wrote:
>
>
> Hello Community!
>
> This is just a quick message to let everyone know that the MATLAB
> Contest Masters have been hard at work!

Bad timing for "planned server maintenance". I hope Brian Welch
wasn't behind this!

Shashi Khatri

unread,
May 15, 2007, 1:31:02 PM5/15/07
to
Thanks guys.

Another dumb question, the contest is open till Wednesday 12PM EDT,
right?

MikeR

unread,
May 15, 2007, 3:48:48 PM5/15/07
to
I have a concern about the contest score calculation, two entries
which are near or at the top currently appear to be identical with
scores differing solely based on computation time.

My entry 'Lions' : ID - 41452 - 2007-05-15 14:26:18 - Score -
3947.6295
and
nathan q's entry 'Filigree Siberian Hamster 2': ID - 41457 -
2007-05-15 14:29:33 - Score - 3947.3199

Performing a diff on these produced no differences, then examining
submission time shows that nathans was submitted after mine.

Is is it explained anywhere the effect of a high number of entries
waiting in the queue and the actual score. I assumed that each file
was tested in the same environment?

Thanks!

PS. This contest is addictive

the cyclist

unread,
May 15, 2007, 4:05:46 PM5/15/07
to
It is well known (but perhaps not widely known?) that identical
entries will produce identical result but not identical time. This
is not hard to understand when you consider that all the things going
on with the computer that runs the entries. I know that Mathworks
has stripped it down pretty well, and take a lot of measures to keep
timing as consistent as reasonably possible. But it can't be
perfect. Small time-improvement tweaks are swamped by the
variability in timing.

Alan Chalker

unread,
May 15, 2007, 4:20:00 PM5/15/07
to
the cyclist wrote:
>
> It is well known (but perhaps not widely known?) that identical
> entries will produce identical result but not identical time. This
> is not hard to understand when you consider that all the things
> going
> on with the computer that runs the entries. I know that Mathworks
> has stripped it down pretty well, and take a lot of measures to
> keep
> timing as consistent as reasonably possible. But it can't be
> perfect. Small time-improvement tweaks are swamped by the
> variability in timing.

Since the contest is drawing to a close, this presents an opportunity
to start making suggestions for improvements. Its been suggested
many times in the past, but I'll again suggest that the number 1
improvement would be to put a roundoff in the time contribution to
overall score. I think rounding off to the nearest tenth or quarter
of a second would still entice people to try to tweak parameters ,
but would eliminate the variability due to system variations.

On both occasions during this contest when I submitted a heavily
commented version of the leading code, my commented version took the
lead for quite a while. I made no algorithmic changes to the code,
yet due to the fact I submitted them when the queue's were empty and
machine basically idle I got a slight speedup in the run-time. While
that was a nice quirk, it clearly illustrates the variability queue
load has on the timing calculations.

Anybody have any other suggestions for way to improve the contest?

Ned Gulley

unread,
May 15, 2007, 4:33:16 PM5/15/07
to
MikeR wrote:
>
> I have a concern about the contest score calculation,
> two entries which are near or at the top currently
> appear to be identical with scores differing solely
> based on computation time.

Hi Mike:

The cyclist is right to say that, try as hard as we might (and we do
try) identical files get different running times.

I carefully diff'd the two files you describe, and you're right, they
are identical. If this were a matter of winning the contest (or
winning one of our mini-contest challenges), we would award the prize
to the person who first submitted the code that did the best. In this
case, you would get the prize. But since there's no prize at stake,
we just let stuff like this ride.

As the contest nears its end, people are often working near the
"noise floor" of our measuring capability. They are making tiny
improvements that could easily be negated by a passing cosmic ray. We
like to think that this is part of the charm of the contest. In any
event, we ask that people not intentionally resubmit identical code.
It won't help you win a prize.

-Ned.

nathan q

unread,
May 15, 2007, 6:08:54 PM5/15/07
to
Hi Mike and all

For the record, these two entries were developed independently. In
fact, according to the "based on" credits, both came from BirdBrain's
Bill Murray's Explosive Gerbil, which was the leader at the time. I
was just fiddling with the obvious parameters - it's not surprising
that two of us would come up with identical tweaks. It's right that
the earlier submission should get the credit if a prize is at stake.

Nathan

PS thanks, Mathworkers, for another great contest.

Jin

unread,
May 15, 2007, 9:45:32 PM5/15/07
to
The "Best Result by 4 PM Challenge" seems a bad idea in some senses.
The big tweaking bomb will suppress the all the remaining time of
Tuesday.(100*3/60=5hours) The most are waiting for the random
*magic*. Maybe contest team could add more PCs to process the queue?

Alan Chalker

unread,
May 15, 2007, 9:53:31 PM5/15/07
to

To the contrary, I think this was a brilliant move on their part. By
effectively 'shutting down the feedback loop' they've dropped us into
a 'dusk' like state. Unlike twilight where we can see all the scores
but not the code, here we can see the code but not the scores.
Something like this has been suggested several times in the past as a
way to reduce the effect of last minute tweaking on the final grand
prize winner and put more focus on algorithm development.

I personally hope the queue gets filled up even more overnight such
that tomorrow morning we are in a similar situation.

Jin

unread,
May 15, 2007, 10:16:22 PM5/15/07
to
AC, if considered for a algorithm development, you are really
right^_^ And I like your well-documented codes^_^

Markus

unread,
May 16, 2007, 3:15:43 AM5/16/07
to
I can just repeat my suggestions to simply add a "captcha" to the
entry submission form. I know the contest team has already put this
suggestions on their "to-do" list, but they did not have the time to
do the change yet. I guess they also have other work to do besides
the contest.

Limiting the number of submissions for each contestant, for example,
per hour or per day, would also be nice, but as we only put a nick
and an E-mail address, it will be hard to realize such rule.

Markus

Sergey Yurgenson

unread,
May 16, 2007, 8:16:06 AM5/16/07
to
Anybody who wants to overload queue and create “dusk” state can
easily do it.
I just do not know if it is consistent with extremely cooperative
spirit of current contest.
On another side, last second meaningless tweak of somebody else
significant code improvement is not good either.

Sergey

Steve Hoelzer

unread,
May 16, 2007, 10:01:23 AM5/16/07
to
My thoughts on improving future contests:

- Round cpu time to 0.1 sec to avoid timing inconsistencies.

- Add column for cyclomatic complexity.

- Show statistics page earlier in the contest.

- Add a reasonably accurate timestamp of The Mathwork's official time
to the top of the submit page. It doesn't have to be perfect, but it
would help with last minute entries.

- For the 1000 character challenge, don't count whitespace
(whitespace = spaces, tabs, and newlines). That way, entries can have
commands on different lines and keep proper indentation. I included a
simple script below that can do the counting.

All that said, it has been another great contest. Thanks Mathworks
team! Also thanks to all the contestants for the well-commented code
and following the 'no welching' rule.

Steve

------------------------------------------------

function c = charcountnowhitespace(fn)
% Count the characters in a file, excluding whitespace (spaces, tabs,
and
% newlines). Returns the character count, or -1 if file error.
%
% Example call: c = charcountnowhitespace('charcountnowhitespace.m')

% Steve Hoelzer 2007-05-16

fid = fopen(fn);
if fid == -1
c = -1; % error opening file
return
end

% Count chars
c = 0;
line = fgetl(fid);
while isempty(line) || line(1) ~= -1
line(line == 32) = []; % remove spaces
line(line == 9) = []; % remove tabs
line(line == 10) = []; % remove newlines
c = c + length(line);
line = fgetl(fid);
end

if fclose(fid)
c = -1; % error closing file
end

KSz

unread,
May 16, 2007, 10:57:41 AM5/16/07
to
and don't let anyone post a new code five times a minute...

the cyclist

unread,
May 16, 2007, 12:10:49 PM5/16/07
to
Helen Chen wrote:
>
>
> Hello Community!
>
> This is just a quick message to let everyone know that the MATLAB
> Contest Masters have been hard at work!

So, it's all over but the crying. Thanks to the team for an
exceptionally smooth contest. I was really happy that obfuscation
didn't really enter, and that folks adhered to the request for no
Welching. The most infuriating part of the last couple contests was
when the queue broke down completely, so it was nice that that did
not happen this time around.

Good luck to all entries still in the queue. I estimate that it will
be done processing by around 15:00 EDT, all the entries run in about
the same CPU time as the current leader.

the cyclist (aka "tev")

MikeR

unread,
May 16, 2007, 12:24:15 PM5/16/07
to
Community,

I concur, this contest has been blast! The Matlab team deserves
thanks for keeping this running without any hitches!

Now we get to eagerly await the final outcome, I have a strong
feeling that "tev" will overtake me. It will be interesting if
another approach bests the current leader.

My effective entry popped a little to early,~10mins, so the masses
have consumed :)

sidenote: Ken Eaton you sure do know how to make this suspenseful.

- MikeR

the cyclist

unread,
May 16, 2007, 12:56:18 PM5/16/07
to
MikeR wrote:

> It will be interesting if
> another approach bests the current leader.

I am curious what improvements are in the queue. Obviously, there is
some pure parameter tweaking, and that is always a threat.

I personally have two separate time improvements. They are small but
"real", and should both get over the timing variability, I think.

1) I replaced "sum(board(:)>0)" with "nnz(board)".

2) I defined iii=[i;i], and did a wholesale replacement of "i;i" with
"iii", along with a couple related efficiencies. Ditto with jjj.

I had a third replacement that I thought would be an improvement,
which was to define a variable "peg=board(:)>0", which identified
where pegs were. This could be used later in the calculation of the
count of pegs, and a couple of other ways. However, it seems this
did not really improve the time.

Hannes Naudé & Cobus Potgieter

unread,
May 16, 2007, 1:01:56 PM5/16/07
to
We have been working offline for a bit, so have only now had the
chance to take a look of some of the code in the queue.

We are a bit baffled by how the following code could possibly come to
exist without some probing of the contest suite going on. Yet many
appear to be using it??

fc=((pegCount < 250)||...
(pegCount==272)||...
(pegCount==516)||...
(pegCount==544)||...
(pegCount==535)||...
(pegCount==540)||...
(pegCount==542)||...
(pegCount==542)||...

To be clear, we are not accusing anyone of anything. just asking...?

Thanks to the Mathworks contest team for one of he best contests yet.

Regards
Hannes & Cobus
a.k.a. Jacob & matlabboy
P.S. Yes we now our aliases and submission titles are stupid but you
do what you can to avoid being picked up by cyc's improvement radar.
Allthough it looks like this time it was Yi that caught us.

Sergey Yurgenson

unread,
May 16, 2007, 1:29:56 PM5/16/07
to
I want to thank organizers and participants for great competition. It
was a real pleasure to be here. Very good cooperative spirit this
time. (It would be really unfortunate if somebody decided to use
probing. Frankly speaking it just kills competition)

At the end I was trying to introduce three minor algorithm
modifications:

1. Make “random loop” run longer for board with higher mean weight
2. Combine subsol and solveri (run solveri inside subsol when there
are few pegs left) . Too much time penalty here, probably.
3. Count pegs on “black fields and white fields” (imagine that board
is colored as chess board, black pegs always stay black and always
remove white and vise versa) and introduce additional weight
parameter depending on ratio of sizes of two peg groups.

Best wishes to everybody,

Sergey

Ken Eaton

unread,
May 16, 2007, 1:51:45 PM5/16/07
to
MikeR wrote:
>
> sidenote: Ken Eaton you sure do know how to make this suspenseful.

Is that in reference to my frantic last-minute submissions of what
will likely be unsuccessful attempts?

First I'd like to say thanks to all the MathWorks staff. Although I
am a long time MATLAB user, this was only the first contest I
submitted anything for (I tried for the Black Box, but never finished
anything in time to submit). Unfortunately, for this contest I didn't
have enough time to really dig in and see what other algorithms were
being tried by others. Still had fun though!

Most of my attempts centered around the idea of "black" and "white"
squares competing with one another (mentioned by a few people on
here), hence why I prefaced all my submissions with "predator/prey".
We'll see how my newest ones do (probably not as good as the top
contenders).

Joseph

unread,
May 16, 2007, 1:57:54 PM5/16/07
to
Tev,

How did you send over 15 tweaks of entries in the queue in less than
2 minutes? That is 1 every 8 seconds! You must have been pedaling
really fast...

Joseph

Yi Cao

unread,
May 16, 2007, 2:35:21 PM5/16/07
to

Hannes & Cobus,

Thanks let us know your aliases. I pick up entries submitted by
matboy by chance. This morning, when I opened an IE window to look
the queue, I found a suspicious entry in the queue by matlabboy
without a valid email address. By searching matlabboy I found three
entries. All codes have a return with moves = [0 0 0 0] at the end.
Clearly, these entries is to test some improvement on solveri code.
Therefore, I copied one of these codes into my codes for the final
submission. For the above codes, I found from Jin's entry Iamcrazy31,
I belieave this is a prob series.

I wish to think to Mathwork team to organize this contest. This is a
very interesting problem. One can easily get an idea to improve the
algorithm. However, the time penalty makes many of them. This
morning, I just got an idea to improve the speed. After an hour's
work, finally I made it works. To make this code more valuable, I
waited until almost last minutes to scan the queue to try to catch
some new code to combine with this improvement. Wish myself good
luck.

Yi Cao

It is loading more messages.
0 new messages