Skip to content

Conversation

@fedebenelli
Copy link

Hi! I've seen your code and it can be really useful in some of my works. I've did some editions to it to make it able to use it as a dependency with the Fortran Package Manager fpm, this will be helpful for me and other users that want to use your code in their work.

Besides that compatibility, I did some minor changes to make it easier to use in other projects. Now the optimizer routine is included in a module instead of being a main program, and receives the desired fitness function as an argument. An usage example can be seen at the new directory example:

program main
    use fitness_example, only: fitness
    use PSOclassicG, only: pso
    use iso_fortran_env, only: pr => real64

    real(pr) :: x(30), xmin(30), xmax(30)

    xmax = 30
    xmin = -30
    call pso(fitness, x, psize=30, verbose=.true., xmin=xmin, xmax=xmax)
end program main

With fpm installed an user can try this example by running fpm run --example inside the repo folder.

Other way of using it is making a fpm project and including this package as a dependency in the fpm.toml manifest file

[dependencies]
Particle-Swarm-Optimization-Fortran-95 = {git =https://github.com/zaman13/Particle-Swarm-Optimization-Fortran-95 }

Without downloading anything manually now the optimizer can be available to call in another project.

I don't know much details of the algorithm itself, but this could be further improved to have a nice package for other users :)

@fedebenelli
Copy link
Author

More work can be done, but I avoided touching the code as much as I could since I'm not an expert of the algorithm itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant