-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgp.f03
More file actions
56 lines (48 loc) · 2.25 KB
/
gp.f03
File metadata and controls
56 lines (48 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
MODULE gp
USE parameters
USE typedefs
CONTAINS
SUBROUTINE fitness(o3_prod,o3_dest,fluence,dimens,matrix,wait_list)!,total_fitness)
! Purpose:
! This subroutine measures the fitness of the current simulation.
! the resulting fitness is added to the total fitness thusfar.
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! FITNESS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IMPLICIT NONE
INTEGER , POINTER :: o3_prod,o3_dest
INTEGER , DIMENSION(:,:,:), POINTER :: matrix
INTEGER, DIMENSION(3) :: dimens
REAL(KIND=DBL) :: denom
REAL(KIND=DBL) :: fluence
!INTEGER , POINTER :: total_fitness
INTEGER :: i,j,k
INTEGER :: ozone_count
TYPE(wait_info) , DIMENSION(:) , POINTER :: wait_list
! volume * 1E20
ozone_count = 0
denom = THICK*EDGE*EDGE*1E20
! total_fitness = total_fitness + some_comparative_diff
DO k = 1,dimens(3)
DO j = 1,dimens(2)
DO i = 1,dimens(1)
IF ( matrix(i,j,k) .NE. 0 ) THEN
IF ( matrix(i,j,k) .LT. 0 ) THEN
IF ( ABS(matrix(i,j,k)) .EQ. 7 ) THEN
ozone_count = ozone_count + 1
END IF
ELSE IF ( matrix(i,j,k) .GT. 0 ) THEN
IF ( wait_list(matrix(i,j,k))%sp_num .EQ. 7 ) THEN
ozone_count = ozone_count + 1
END IF
END IF
END IF
END DO
END DO
END DO
PRINT *, 'F_obj(', fluence, ') = ', (4*(fluence**0.8))/(1E13**0.8+fluence**0.8) ! hard-coded expected value (objective) function
PRINT *, 'F_model(', fluence, ') = ', REAL(ozone_count)/denom
PRINT *, '***********************************************************************'
END SUBROUTINE fitness
END MODULE gp