Parallel Python
Home arrow Forums arrow Python Forums arrow Parallel Python Forum arrow Parallel Python Extensions and Applications arrow Genetic algorithm Differential Evolution using Parallel Python
Is your Python knowledge up to date? Shop for Python books on Amazon.
Parallel Python Community Forums rss  
January 06, 2016, 12:02:01 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Parallel python forum is up and running!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Genetic algorithm Differential Evolution using Parallel Python  (Read 20277 times)
0 Members and 1 Guest are viewing this topic.
zunzun
Sr. Python
****

Karma: 1
Posts: 41



View Profile WWW
« on: January 20, 2008, 05:09:33 PM »

-- Please use the updated code in the second posting below, it runs faster than this 1st draft. --

Here is my 1st round of tested code for the genetic algorithm Differential Evolution (http://www.icsi.berkeley.edu/~storn/code.html) using Parallel Python.

The two attached code files are in the form of:
     DESolver.py - encapsulates the Differential Evolution algorithm and Parallel Python code
     DETest.py - test code and example usage
and requires Numeric Python (numpy, http://numpy.scipy.org) - Debian and Ubuntu users can 'apt-get install python-numpy'.  Since generating random numbers can be time and computationally expensive, there is an option to use one-time fixed arrays of random numbers again speeding the code.  I also include an optional polisher to speed up the algorithm, this requires Scientific Python (scipy, http://www.scipy.org) - Debian and Ubuntu users can 'apt-get install python-scipy'.


In DETest.py, the small TestSolver class consists only of the test data and the function calculation to be minimized, in this case a simple sum-of-squared-error curve fit to the test data points.  Just run 'python DETest.py' to see the code in action.

The DESolver.py file holds most of the code, including everything related to Parallel Python.

     James

* DESolver.py (18.3 KB - downloaded 433 times.)
* DETest.py (2 KB - downloaded 259 times.)
* DETest.py (2 KB - downloaded 143 times.)
« Last Edit: January 22, 2008, 02:32:55 AM by zunzun » Logged
zunzun
Sr. Python
****

Karma: 1
Posts: 41



View Profile WWW
« Reply #1 on: January 22, 2008, 02:31:15 AM »

Updated the logic a bit by pushing the polisher into the worker processes.  Runs faster now when polishing.

     James

* DESolver.py (17.94 KB - downloaded 451 times.)
* DETest.py (2.23 KB - downloaded 355 times.)
Logged
mcreel
Full Python
***

Karma: 1
Posts: 18


View Profile
« Reply #2 on: January 31, 2008, 01:50:39 AM »

Many thanks! I'm very interested in testing this. I need to find some time to do it, but I really appreciate having this code to learn from.

Well, I ran it, and it seemed to work fine. Hopefully I'll be able to study it more carefully before long. Thanks again.
« Last Edit: January 31, 2008, 01:59:10 AM by mcreel » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Nutrition facts and analysis