Timeit

cokofreedom at gmail.com cokofreedom at gmail.com
Thu Feb 19 02:35:16 CET 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!



More information about the Python-list mailing list