473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Python Programming Contest

I've decided that it would be be fun to host a weekly Python programming
contest. The focus will be on algorithms that require a bit of thought
to design but not much code to implement.

I'm doing to judge the solutions based on execution speed. It sucks but
that is the easiest important consideration to objectively measure. I'll
also indicated which solutions I think are good examples of Python
design. Hopefully, people's solutions can provide a resource for people
looking for best practice examples and also for people looking for
performance ideas.

You can find the first problem here:
http://www.sweetapp.com/pycontest/contest1

I'm always looking for feedback, so let me know what you think or if you
have any ideas for future problems.

Cheers,
Brian

Jul 21 '05 #1
13 2248
Are you aware of http://mathschallenge.net/index.php?section=project ?

The "The focus will be on algorithms that require a bit of thought
to design but not much code to implement." part seems common, although
your problem domain probably is larger.

/Simon

Jul 21 '05 #2


Brian Quinlan wrote:
I've decided that it would be be fun to host a weekly Python programming
contest. The focus will be on algorithms that require a bit of thought
to design but not much code to implement.

I'm doing to judge the solutions based on execution speed. It sucks but
that is the easiest important consideration to objectively measure. I'll
also indicated which solutions I think are good examples of Python
design. Hopefully, people's solutions can provide a resource for people
looking for best practice examples and also for people looking for
performance ideas.

You can find the first problem here:
http://www.sweetapp.com/pycontest/contest1

I'm always looking for feedback, so let me know what you think or if you
have any ideas for future problems.

Cheers,
Brian


I am not sure if it is a good idea to use a LiveCD for OS when you are
testing for speed. CD access speeds fluctuate and may even impact
performance even if you start measuring after the module loading is
complete.

Jul 21 '05 #3
James wrote:
I am not sure if it is a good idea to use a LiveCD for OS when you are
testing for speed. CD access speeds fluctuate and may even impact
performance even if you start measuring after the module loading is
complete.


It didn't seem to matter in my testing. Module loading is done before
the test is run. Also, it is easiest to protect my system against
malicious code if it is being run on an OS without a writeable filesystem.

Cheers,
Brian
Jul 21 '05 #4
Brian Quinlan enlightened us with:
Also, it is easiest to protect my system against malicious code if
it is being run on an OS without a writeable filesystem.


Even easier with User Mode Linux and a COW (copy on write) filesystem.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Jul 21 '05 #5
Brian Quinlan wrote:
I've decided that it would be be fun to host a weekly Python programming
contest.
I like the idea, and doing the first problem was fun indeed
:o)
I'm always looking for feedback, so let me know what you think or if you
have any ideas for future problems.


It would be nice if you could put up a suite of test data with oracle
solutions for download. For those sitting behind a modem line (like me),
it would be a great help and speed up of the testing cycle.

Thanks for your effort, in any case!

--
Thomas
Jul 21 '05 #6
[Brian Quinlan]
I'm doing to judge the solutions based on execution speed. It sucks but
that is the easiest important consideration to objectively measure. . . . I'm always looking for feedback, so let me know what you think or if you
have any ideas for future problems.


I'm curious about the stability of your timing setup. If you run your
own version of fly.py several times with the same starting seed, how
much variation do you see between runs?

When I tried the provided setup, it was highly variable. To get useful
measurements, I needed another timing framework:

import timeit

setup = """
import fly_test
import random

from fly import fly
random.seed(1234567891)
params = []
for i in xrange(100):
schedule = fly_test.generate_schedule()
from_, to = fly_test.pick_cities(schedule)
params.append( (from_, to, schedule) )
"""

stmt = """
for p in params:
fly(*p)
"""

print min(timeit.Timer(stmt, setup).repeat(5, 3))

Jul 21 '05 #7
Raymond Hettinger wrote:
I'm curious about the stability of your timing setup. If you run your
own version of fly.py several times with the same starting seed, how
much variation do you see between runs?


There is very little variation (about 0.1%) but my solution is over an
order of magnitude slower than some of the submissions that I've gotten.
It is likely that the overhead of my timing code is significant when
running your solution.

I may have to *slightly* revise my test code to get better results. I
think that I can do so without changing the distribution of the random
schedule so as not to be biased against some solutions.

Cheers,
Brian
Jul 21 '05 #8
Here are the results for the first problem in the Python Programming
Contest.

I haven't been able to find as much time as I excepted, so my analysis
is not very in depth.

You can find the results here:
http://www.sweetapp.com/pycontest/contest1/results.html

And the problem definition here:
http://www.sweetapp.com/pycontest/contest1/

Kudos to everyone who participated but especially to Raymond Hettinger
and Thomas Lotze, whose solutions were nearly 50 times faster than mine.

I'd also like to point out that Thomas Guettler's solution, which is the
slowest, was completed in less than 3 hours after the contest was
announced. That's impresive for a correct solution.

Cheers,
Brian
Aug 1 '05 #9
Brian Quinlan wrote:
Here are the results for the first problem in the Python Programming
Contest.

I haven't been able to find as much time as I excepted, so my analysis
is not very in depth.

You can find the results here:
http://www.sweetapp.com/pycontest/contest1/results.html

And the problem definition here:
http://www.sweetapp.com/pycontest/contest1/

Kudos to everyone who participated but especially to Raymond Hettinger
and Thomas Lotze, whose solutions were nearly 50 times faster than mine.

I'd also like to point out that Thomas Guettler's solution, which is the
slowest, was completed in less than 3 hours after the contest was
announced. That's impresive for a correct solution.

Cheers,
Brian


Why don't I see my solution (__author__ = "dOb") in the results? I'm
sure that you got it as you replied to my mail.

Where do the timing results come from? Is it the number that
fly_test.main(['fly']) outputs? I don't think it is that because with my
solution that would be ~0.06 seconds.

Great competition anyway, I want to see more of these :)

--
dOb
Aug 1 '05 #10
Tomi Kyöstilä wrote:
Why don't I see my solution (__author__ = "dOb") in the results? I'm
sure that you got it as you replied to my mail.
Ahhh...sorry. I have your solution and I timed it but I don't have the
results here so I can't add it to the website. I'll do it tomorrow.
Where do the timing results come from? Is it the number that
fly_test.main(['fly']) outputs? I don't think it is that because with my
solution that would be ~0.06 seconds.


This is the time required to do several thousand trials.

Cheers,
Brian
Aug 2 '05 #11
Brian Quinlan wrote:
Tomi Kyöstilä wrote:

Why don't I see my solution (__author__ = "dOb") in the results? I'm
sure that you got it as you replied to my mail.


Your solution is now included. See:
http://www.sweetapp.com/pycontest/contest1/results.html

Good job!

Cheers,
Brian
Aug 3 '05 #12
Brian Quinlan wrote:
Brian Quinlan wrote:
Tomi Kyöstilä wrote:

Why don't I see my solution (__author__ = "dOb") in the results? I'm
sure that you got it as you replied to my mail.

Your solution is now included. See:
http://www.sweetapp.com/pycontest/contest1/results.html

Good job!

Cheers,
Brian


Thanks! :)

Any idea when the next competition is coming? (it hasn't been quite
weekly as you hoped, eh? ;)

--
dOb
Aug 3 '05 #13
Tomi Kyöstilä wrote:
Any idea when the next competition is coming? (it hasn't been quite
weekly as you hoped, eh? ;)


Uh no. It turns out that I have less time than I thought, though a big
chunk of it should be freed-up after this weekend. I do have an idea... :-)

Cheers,
Brian
Aug 3 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Varun | last post by:
Hi Friends, Department of Information Technology, Madras Institute of Technology, Anna University, India is conducting a technical symposium, Samhita. As a part of samhita, an Online Programming...
0
by: Sridhar | last post by:
Hi, We, the students of CEG, Anna University are organizing an online programming contest as part of aBaCus 2005. The contest itself will start on 6th March 2005 at 1:00 pm IST and will end...
0
by: Sridhar | last post by:
Hi, We, the students of CEG, Anna University are organizing an online programming contest as part of aBaCus 2005. The contest itself will start on 6th March 2005 at 1:00 pm IST and will end...
8
by: Rahul | last post by:
Hi. I am part of a group in my univ where we organize a programming contest. In this contest we have a UDP based server. The server simulates a game and each contestant is to develop a team of...
0
by: Brian Quinlan | last post by:
This is just a reminder that the deadline for my little programming competition is Monday. Original E-mail --------------- I've decided that it would be be fun to host a weekly Python...
23
by: Simon Hengel | last post by:
Hello, we are hosting a python coding contest an we even managed to provide a price for the winner... http://pycontest.net/ The contest is coincidentally held during the 22c3 and we will be...
0
by: Tom 7 | last post by:
Language lovers: Registration is now open for the 9th Annual ICFP Programming Contest! http://icfpcontest.org/ The contest, associated with the International Conference on Functional...
0
by: Paul Boddie | last post by:
QOTW: "Given these criteria, my recommendations for a first programming language would be Python or Scheme." - Peter Norvig (some time ago, but referenced on comp.lang.lisp this week)...
22
by: SETT Programming Contest | last post by:
The SETT Programming Contest: The fastest set<Timplementation Write the fastest set<Timplementation using only standard C++/C. Ideally it should have the same interface like std::set. At least...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.