Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
364 changes: 0 additions & 364 deletions Fortran codes/PSOclassicG.f95

This file was deleted.

Binary file removed Fortran codes/PSOclassicG_output
Binary file not shown.
31 changes: 31 additions & 0 deletions example/fitness.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module fitness_example
use iso_fortran_env, only: pr => real64
implicit none

contains
subroutine fitness(x, cost)
real(pr), intent(in) :: x(:)
real(pr), intent(out) :: cost
real(pr) :: temp1
real(pr) :: temp2

integer :: loop1, D

D = size(x)

cost = 0
temp1 = 0
temp2 = 0

! -> Ackley
do loop1 = 1, D
temp1 = temp1 + x(loop1)**2
temp2 = temp2 + cos(2*3.141592653589793*x(loop1))
end do

temp1 = (temp1/D)**0.5
temp2 = temp2/D
cost = -20*exp(-0.2*temp1) - exp(temp2) + 20.0 + exp(1.0)
! <- Ackley
end subroutine fitness
end module
Loading