Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.5%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: umitanilkilic
  • License: mit
  • Language: Go
  • Default Branch: main
  • Size: 33.2 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Created almost 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

README.md

PSO (Particle Swarm Optimization)

Installation

bash go get github.com/umitanilkilic/pso

Usage

Usage

To use the PSO library, you can import it into your Go project and start optimizing your problems. Here's an example of how to use it:

```go package main

import ( "fmt" "math" "math/rand"

"github.com/umitanilkilic/pso"

)

var spaceSize = 100.0 var psOptimizer pso.PSO

func main() { //easom function

f := func(p pso.Position) float64 {
    return -1 * (math.Cos(p.GetCoordinates()[0]) * math.Cos(p.GetCoordinates()[1]) * math.Exp(-1*(math.Pow(p.GetCoordinates()[0]-math.Pi, 2)+math.Pow(p.GetCoordinates()[1]-math.Pi, 2))))
}
//initialize particles
particles := createParticles()
//initialize swarm
swarm := pso.NewSwarm(0.5, 0.5, 0.5, particles, f, constraintFunc)
psOptimizer = pso.NewPSO(&swarm)
psOptimizer.SetIterationCount(10)
//run pso
psOptimizer.Optimize(printParticleInfo)

fmt.Printf("Global best: %v\n", swarm.GetGlobalBest())
fmt.Printf("Fitness: %v\n", f(swarm.GetGlobalBest()))

}

func constraintFunc(position *pso.Position) { for i := 0; i < position.GetDimension(); i++ { if position.GetCoordinates()[i] < -spaceSize { position.GetCoordinates()[i] = -spaceSize } else if position.GetCoordinates()[i] > spaceSize { position.GetCoordinates()[i] = spaceSize } } }

func createParticles() []pso.Particle { particles := make([]pso.Particle, 0) for i := 0; i < 100; i++ { pos := pso.NewPosition(float64(rand.Float64()spaceSize), float64(rand.Float64()spaceSize)) vel := pso.NewPosition(float64(rand.Float64()spaceSize), float64(rand.Float64()spaceSize)) particles = append(particles, pso.NewParticle(i, pos, vel)) } return particles }

func printParticleInfo(particles *pso.Swarm) { iteration := psOptimizer.GetCurrentIteration() fmt.Printf("Iteration: %v, Global Best Position: %v\n", iteration, particles.GetGlobalBest()) }

```

Make sure to replace the objective function logic and the bounds with your own problem-specific implementation. You can also adjust the number of dimensions, particles, and iterations according to your needs.

For more information, please refer to the PSO documentation.

Citation

If you use this code in your research, please cite the following paper:

bibtex @software{KILIC_Particle_Swarm_Optimization, author = {KILIC, UMIT ANIL}, license = {MIT}, title = {{Particle Swarm Optimization Library}}, url = {https://github.com/umitanilkilic/pso} }

License

This project is licensed under the MIT License - see the LICENSE file for details.

Owner

  • Name: Ümit Anıl Kılıç
  • Login: umitanilkilic
  • Kind: user
  • Location: Ankara

Citation (CITATION.cff)

cff-version: 1.2.0
title: Particle Swarm Optimization Library
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: UMIT ANIL
    family-names: KILIC
    email: umitanilkilic@gmail.com
repository-code: 'https://github.com/umitanilkilic/pso'
abstract: >-
  This project presents a basic Particle Swarm Optimization
  (PSO) library written in the Go programming language. PSO
  is a popular algorithm used for solving optimization
  problems. This library provides the core functionalities
  of PSO in Go, allowing users to easily utilize this
  algorithm in their own projects.
keywords:
  - Particle Swarm Optimization
  - PSO
  - Go
  - Optimization Library
license: MIT
commit: cefb121d833f05c39849cd719f4d51eb9aa0f5fa

GitHub Events

Total
Last Year

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 0
proxy.golang.org: github.com/umitanilkilic/pso
  • Versions: 0
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.3%
Average: 7.6%
Dependent repos count: 7.8%
Last synced: 6 months ago