Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Timeit

Reply
Thread Tools

Timeit

 
 
cokofreedom@gmail.com
Guest
Posts: n/a
 
      02-19-2009
I've having an annoying problem at the moment. I'm writing code for
the travelling salesmen problem and comparing different techniques.
But I've having a problem using timeit.

I have a file called "testplatform.py" that contains 4 class:
Test() - which is called first to create the cities/routes to be
shared between the other classes
AutoClone() - which uses the variables from Test() (normally test =
Test())
Randomisation() - Ditto
BruteForce() - Ditto

if __name__ == '__main__':
.....test = Test(5, 1000, 100, 100, 100, 14)
.....example1 = AutoClone(test.citynames, test.cityroutes, test.seed,
.........................test.generations, test.mutate)
.....example2 = Randomisation(test.citynames, test.cityroutes,
test.seed,
.........................test.generations)
.....example3 = BruteForce(test.citynames, test.cityroutes)

I am really stuck trying to work out how to pass variables to timeit
to allow me to run any of the examples...

Any help would be great!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
timeit.timeit and timeit.repeat give different answers Dan Christensen Python 4 07-14-2004 06:54 AM
timeit Duncan Smith Python 3 01-31-2004 04:00 PM
RE: timeit Robert Brewer Python 1 01-31-2004 03:49 PM
timeit.repeat() inaccuracy on W2K? Dennis Benzinger Python 1 11-26-2003 06:13 AM
timing a function with timeit? (newbie problem) news.west.cox.net Python 1 08-28-2003 01:24 AM



Advertisments