Timeit

Discussion in 'Python' started by cokofreedom@gmail.com, Feb 19, 2009.

  1. Guest

    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!
    , Feb 19, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.west.cox.net

    timing a function with timeit? (newbie problem)

    news.west.cox.net, Aug 28, 2003, in forum: Python
    Replies:
    1
    Views:
    497
    Chad Netzer
    Aug 28, 2003
  2. Dennis Benzinger

    timeit.repeat() inaccuracy on W2K?

    Dennis Benzinger, Nov 25, 2003, in forum: Python
    Replies:
    1
    Views:
    331
    Raymond Hettinger
    Nov 26, 2003
  3. Duncan Smith

    timeit

    Duncan Smith, Jan 31, 2004, in forum: Python
    Replies:
    3
    Views:
    464
    Skip Montanaro
    Jan 31, 2004
  4. Robert Brewer

    RE: timeit

    Robert Brewer, Jan 31, 2004, in forum: Python
    Replies:
    1
    Views:
    388
    Duncan Smith
    Jan 31, 2004
  5. Dan Christensen
    Replies:
    4
    Views:
    562
    Peter Otten
    Jul 14, 2004
Loading...

Share This Page