## de 1.0.3

A Library for Differential Evolution Optimization

Created by Matletik - Mathematical Manipulatives and Interactive Learning Tools

http://www.matletik.com

## Usage #

A simple usage example:

``````import 'package:de/de.dart';

double f(List<double> x) {
return -(pow(x[0] - 3.14159265, 2.0) + pow(x[1] - exp(1.0), 2.0));
}

void main(){
DE de = DE(f, [-500, -500], [500, 500], cr: 0.99, F: 1.20, popsize: 300);
de.iterateN(5000);
Solution best = de.getBest();
print(best);
}
``````

## Details #

• The objective function is always in the form of
``````double f(List<double> 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 Differential Evolution Optimization are set to cr = 0.8 and F = 1.0. These optimization parameters can be customized in the constructor of DE class.

## 1.0.3 #

• Reduced warnings due to Dart Analysis
• Code reformatted.

## 1.0.2 #

• Description changed.

## 1.0.1 #

• Description changed.

## 1.0.0 #

• Initial version, created by Matletik.

example/de_example.dart

``````import 'package:de/de.dart';
import 'package:de/src/Solution.dart';

void main() {
List<double> vals = [
1.0,
2.0,
3.0,
4.0,
5.0,
6.0,
700.0,
800.0,
900.0,
100.0
];
double f(List<double> x) {
double s = 0.0;
for (int i = 0; i < vals.length; i++) {
s += (vals[i] - x[0]).abs().toDouble();
}
return -s;
}

DE de = DE(f, [-100.0], [100.0], cr: 0.99, F: 1.50, popsize: 300);
de.iterateN(10000);
de.calculateFitnessForAll();
Solution best = de.getBest();

print(best);
}
``````

## Use this package as a library

### 1. Depend on it

``````
dependencies:
de: ^1.0.3

``````

### 2. Install it

You can install packages from the command line:

with pub:

``````
\$ pub get

``````

with Flutter:

``````
\$ flutter pub get

``````

Alternatively, your editor might support `pub get` or `flutter pub get`. Check the docs for your editor to learn more.

### 3. Import it

Now in your Dart code, you can use:

``````
import 'package:de/de.dart';
``````
 Popularity: Describes how popular the package is relative to other packages. [more] 0 Health: Code health derived from static analysis. [more] 99 Maintenance: Reflects how tidy and up-to-date the package is. [more] 95 Overall: Weighted score of the above. [more] 49

We analyzed this package on Mar 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

• Dart: 2.7.1
• pana: 0.13.6

#### Health issues and suggestions

Document public APIs. (-1 points)

15 out of 15 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

#### Maintenance suggestions

Homepage URL is insecure. (-5 points)

Update the `homepage` field and use a secure (`https`) URL.

#### Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
pso ^1.0.1 1.0.2
Dev dependencies
pedantic ^1.8.0
test ^1.6.0