V3FIT
ga_selectn.f
1  SUBROUTINE ga_selectn(ipick,j,mate1,mate2)
2 c#######################################################################
3 c
4 c Subroutine for selection operator. Presently, tournament selection
5 c is the ONLY option available.
6 c
7  USE ga_mod
8  IMPLICIT NONE
9 
10  INTEGER :: ipick, j, mate1, mate2
11  INTEGER :: n
12  SAVE
13 c
14  IF(itourny.eq.1) THEN
15  CALL ga_select(mate1,ipick)
16  CALL ga_select(mate2,ipick)
17 c WRITE(3,*) mate1,mate2,fitness(mate1),fitness(mate2)
18  DO 46 n=1,nchrome
19  ichild(n,j)=iparent(n,mate1)
20  IF(nchild.eq.2) ichild(n,j+1)=iparent(n,mate2)
21  46 CONTINUE
22  END IF
23 c
24  END SUBROUTINE ga_selectn