integer*4 :: mnoznik = 10
character*16 :: mode,argn,argi,dir_nam
character*15 :: filename
- real*8 :: loc,fc,sumfitness,sump,avrp,maxfc
+ real*8 :: loc,fc,sumfitness,sump,avrp,maxfc,avrd
real :: rand, r
real*8 :: maxfcever
real*8 :: FunkcjaCeluB, FunkcjaCeluB2, FunkcjaCeluR
-c character*500 :: Weights2Str
character(80),dimension(5) :: wagi
logical :: searching = .false.
logical :: logdata = .true.
logical :: debug = .true.
character*200 :: text, tmptext,tmptext2
character(len=*), parameter :: FMT = "(19F10.5,E15.7,F10.5)"
-c character(len=*), parameter :: FMT = "(F10.5,F10.5,F10.5,F10.5,F10&
-c &.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10&
-c &.5,F10.5,F10.5,F10.5,F10.5,F10.5)"
c =======================================================================
c Main program
c --- debug end ---
call ReadBank(bank)
-
+ call CalcAvgDist(bank,avrd)
+ write(tmptext,'(F7.5)') avrd
+ call write2log("Average distance in bank is "//trim(tmptext))
+
do i=1,BANK_MULTIPLIER*banksize
write(tmptext,'(I4)') i
call write2log("Checking ind "//tmptext)
real*8 :: ind1(19),ind2(19),temp(19)
integer*4 :: loc
loc = 1 + int(rand(0)/(1/18.0))
-c write (*,*) "Krzyzowanie pomiedzy pozycja ",(loc-1),"a",loc
temp = ind2
do i=(loc),19
ind2(i)=ind1(i)
integer :: stat
integer*4 :: status
character*100 :: wiersz,tmp
- !character*500 :: wiersze = ''
inquire(FILE=inpfn,EXIST=ex)
if (ex) then
status = 0
c enddo
c close(ow)
-c ==========================================
-c Testcode before WHAM+ZSCORE integration
-c ==========================================
-c
-c plik=trim(prefix)//"/"//trim(opopsumfn)
-c !print *,trim(plik)
-c open(opopsum, file = plik)
-c write(opopsum,'(200A)') "# WLONG WSCP WELEC WBOND WANG
-c & WSCLOC WTOR WTORD WCORRH WCORR4 WCORR5 WCORR6 WEL_LOC&
-c & WTURN3 WTURN4 WTURN6 WVDWPP WHPB WSCCOR SCORE"
-c do I=1,rozmiar
-c write(opopsum,FMT) pop(i,1),pop(i,2),pop(i,3),pop(i,4), pop(i,5)&
-c &,pop(i,6),pop(i,7),pop(i,8),pop(i,9),pop(i,10),pop(i,11),pop(i,12)&
-c &,pop(i,13),pop(i,14),pop(i,15),pop(i,16),pop(i,17),pop(i,18),pop(i&
-c &,19),pop(i,20)
-c end do
-c close(opopsum)
-c ==========================================
-
-
-c command="mkdir zscore"
-c call system(command)
-
-
end subroutine CreateInputs
fitn=sumfitn
end subroutine
+c ======================================================================
+c CalcAvgDist subroutine
+c ======================================================================
+c Calculates average distance between individuals in the bank
+c ----------------------------------------------------------------------
+ subroutine CalcAvgDist(b,avgd)
+ include 'common.inc'
+ real*8,dimension(banksize,21) :: b
+ real*8 :: d,avgd
+ integer*4 :: nd
+
+ d=0.0 ! distance
+ nd = (banksize-1)*banksize/2 ! number of distances to calculate
+
+ do i=1,banksize-1
+ do j=i+1,banksize
+ do w=1,19
+ d=d+(b(i,w)-b(j,w))**2
+ end do
+ end do
+ end do
+ avgd=sqrt(d)/nd
+ end subroutine
+
c -----------------------------------------------------------------------