jacobwilliams / pikaia Goto Github PK
View Code? Open in Web Editor NEWModern Fortran Edition of the Pikaia Genetic Algorithm
License: Other
Modern Fortran Edition of the Pikaia Genetic Algorithm
License: Other
Dear Jacob,
many thanks for the updated pikaia code.
I am just playing a bit around with it and trying to start it parallel with openmp by adding
some cpu consuming dummy code in the Rosenbrock function (the plan is to apply pikaia to some "real world problem") and
a) in pikaya subroutine after "!Compute initial (random but bounded) phenotypes" comment line
!$omp parallel do private(ip)
do ip=istart,me%np
do k=1,me%n
oldph(k,ip)=urand() !from [0,1] ! urand not thread safe!
end do
call me%ff(oldph(:,ip),fitns(ip))
end do
!$omp end parallel do
(have also set omp_set_nested(.false.) in the example to avoid splitting k loop... )
b) in newpop after "!replace population" comment line
!$omp parallel do private(i)
do i=1,me%np
oldph(:,i)=newph(:,i)
!get fitness using caller's fitness function
call me%ff(oldph(:,i),fitns(i))
end do
!$omp end parallel do
It seems to bring something (not much but anyway) but I have got also 3 more questions related to the problem:
The mersenne-twister module has been split off into a separate FPM package: https://github.com/jacobwilliams/mersenne-twister-fortran
Make that an FPM dependency.
I just clone and tested this project using fpm
(version 0.4.0), as follows:
fpm build
fpm test
and got the following error:
At line 809 of file ././src/pikaia_module.f90
Fortran runtime error: Index '0' of dimension 1 of array 'stackl' below lower bound of 1
Error termination. Backtrace:
#0 0x7f6f65ab57c2 in ???
#1 0x7f6f65ab6289 in ???
#2 0x7f6f65ab689a in ???
#3 0x40a854 in rqsort
at ././src/pikaia_module.f90:809
#4 0x406665 in __pikaia_module_MOD_rnkpop
at ././src/pikaia_module.f90:1243
#5 0x40d6a4 in __pikaia_module_MOD_pikaia
at ././src/pikaia_module.f90:515
#6 0x40bbfe in __pikaia_module_MOD_solve_with_pikaia
at ././src/pikaia_module.f90:650
#7 0x401a28 in pikaia_test
at src/tests/pikaia_test.f90:75
#8 0x403836 in main
at src/tests/pikaia_test.f90:10
<ERROR> Execution failed for object " pikaia_test "
<ERROR>*cmd_run*:stopping due to failed executions
STOP 1
This happens in the subroutine rqsort
, and I am not sure how to solve it.
https://github.com/weixing1531/pikaia/tree/Binary
I wrote a subclass named pikaia_binary_class.
In the class, I change the definition of array gn.
integer(IB),dimension(me%n),intent(out) :: gn
operate the array gn in subroutine cross,mutate,encode,decode with using fortran's BIT INTRINSIC PROCEDURES ,then save memory and increase speed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.