Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbytecode/pso
Particle Swarm Optimization in Dart
https://github.com/jbytecode/pso
Last synced: 2 months ago
JSON representation
Particle Swarm Optimization in Dart
- Host: GitHub
- URL: https://github.com/jbytecode/pso
- Owner: jbytecode
- License: mit
- Created: 2020-02-23T09:50:06.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-21T19:02:28.000Z (6 months ago)
- Last Synced: 2024-09-28T09:25:48.007Z (3 months ago)
- Language: Dart
- Size: 29.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
![Dart CI](https://github.com/jbytecode/pso/workflows/Dart%20CI/badge.svg)
A Library for Particle Swarm Optimization
## Usage
A simple usage example:
```dart
import 'dart:math' as _math;
import 'package:pso/pso.dart';double f(List x){
double s = 0.0;
s = _math.pow(x[0] - 3.14159265, 2.0) + _math.pow(x[1] - 2.71828, 2.0);
return -s;
}void main() {
List mins = [-10, -10];
List maxs = [10, 10];PSO pso = PSO(f, 100, mins, maxs);
pso.iterateN(500);Particle result = pso.findGBest();
print(result);
}
```## Details
* The objective function is always in the form of```dart
double f(List x){
}
```* The optimization is always a maximation. If the objective
function of the problem is a minimization, the returned value of the
objective function can be multiplied by -1.0.* The default parameters of the classical Particle Swarm Optimization
are set to w = 0.5, c1 = 1.0, and c2 = 1.0. These optimization parameters can be customized
in the```dart
void iterateWithParameters(double w, double c1, double c2)
```or
```dart
void iterateNWithParameters(int n, double w, double c1, double c2)
```in the class *PSO*.