[SciPy-User] Parallel Differential Evolution

hannahlona hannah.lona@gmail....
Mon Jan 14 22:50:24 CST 2013


I am trying to update the DE code from the following email with Andrea's
suggestions:
/
(1). numpy.zeros(X) instead of flex.double(X, 0)
(2). 1000*numpy.ones(X) instead of flex.double(X, 1000)
(3). numpy.min(X) for flex.min(X), etc. (mean, sum)
(4). numpy.random.uniform(size=N) for flex.random_double(N) 

However, to get this work, I also had to modify the following:

- modification (4). only works when floats are meant to be used, I guess, so
in the only case: rnd = numpy.random.uniform(size=self.vector_length)
instead of  flex.random_double(N). In the other two cases it is
random_values = numpy.random.random_integers(low=0.0, high=1.0, size=N) 
instead of  flex.random_double(N)
- Also, numpy.nanargmin instead of flex.min_index
- Also, numpy.argsort instead of flex.sort_permutation
- Also, .copy() instead of .deep_copy()
- Finally, numpy.random.seed(0) instead of flex.set_random_seed(0)
/

but I am getting the following error when I try to run the code:

Traceback (most recent call last):
  File "C:...\StornDEcode.py", line 260, in <module>
    run()
  File "C:...\StornDEcode.py", line 255, in run
    test_rosenbrock_function(1)
  File "C:\...\StornDEcode.py", line 232, in __init__
    self.optimizer = 
differential_evolution_optimizer(self,population_size=min(self.n*10,40),n_cross=self.n,cr=0.9,
eps=1e-8, show_progress=True)
  File "C:\...\StornDEcode.py", line 95, in __init__
    self.optimize()
  File "C:\...\StornDEcode.py", line 116, in optimize
    self.evolve()
  File "C:\...\StornDEcode.py", line 166, in evolve
    i1=permut[0]
IndexError: invalid index to scalar variable.

The original code is here:
http://cci.lbl.gov/cctbx_sources/scitbx/differential_evolution.py

And I have uploaded my version of it. I am new to the forum, and to python,
and would appreciate any help anyone has to offer!  StornDEcode.py
<http://scipy-user.10969.n7.nabble.com/file/n17671/StornDEcode.py>  

Hannah




--
View this message in context: http://scipy-user.10969.n7.nabble.com/Parallel-Differential-Evolution-tp12097p17671.html
Sent from the Scipy-User mailing list archive at Nabble.com.


More information about the SciPy-User mailing list