YPEA: Yarpiz Evolutionary Algorithms

YPEA for MATLAB [+] is a general-purpose toolbox to define and solve optimization problems using Evolutionary Algorithms (EAs) and Metaheuristics. To use this toolbox, you just need to define your optimization problem and then, give the problem to one of algorithms provided by YPEA, to get it solved.

List of Provided Algorithms

Currently YPEA supports these algorithms to solve optimization problems. The list is sorted in alphabetic order.

Artificial Bee Colony (ABC)

Continuous Ant Colony Optimization (ACOR)

Bees Algorithm (BA)

Biogeography-based Optimization (BBO)

Covariance Matrix Adaptation Evolution Strategy (CMA-ES)

Differential Evolution (DE)

Firefly Algorithm (FA)

Genetic Algorithm (GA)

Harmony Search (HS)

Imperialist Competitive Algorithm (ICA)

Invasive Weed Optimization (IWO)

Particle Swarm Optimization (PSO)

Simulated Annealing (SA)

Teaching-Learning-based Optimization (TLBO)

Installation

A MATLAB toolbox package file (*.mltbx) is available in the dist folder. You can right-click on this file inside MATLAB, and select the Install option to get it installed on your machine. This is the recommended way of installing YEPA.

However, if you prefer, the source code for YPEA is available in src folder, and you can download it and add the ypea folder to the path of your MATLAB installation.

The toolbox has its own documentation, which is accessible via MATLAB documentation center. You may find it under Supplemental Software section of MATLAB documentation center.

How YPEA Works?

The main steps to setup your problem and solve it using YPEA are listed below:

Define Optimization Problem

Initialize an instance of optimization problem

Set the type of optimization problem (either minimization or maximization)

Define search space and decision variables

Define the objective function

Note: In case on constrained optimization problem, constraints are defined and using methods like penalty functions, they are incorporated into final objective function.

Use Optimization Algorithm

Create an instance of optimization algorithm class

Set the parameters of algorithms

Call solve method of the algorithm, passing the problem object into it

Get the optimization results and visualize (if needed to do so)

A Classic Example

Problem Definition

Assume that we would like to find 20 real numbers in the range [-10,10], which minimize the value of well-known sphere function, defined by:

Particle Swarm Optimization (PSO)

Now, we are ready to use any of algorithms available in YPEA to solve the problem we just defined. Here we are going to use Particle Swarm Optimization (PSO). Let’s create an instance of PSO (ypea_pso) and set its parameters.

One may use so-called Constriction Coefficients for PSO, by running these commands:

phi1 = 2.05;
phi2 = 2.05;
pso.use_constriction_coeffs(phi1, phi2);

Now, we are ready to get our problem solved. Let’s call the solve method of PSO:

pso_best_sol = pso.solve(problem);

The best solution found by PSO is accessible via:

pso_best_sol.solution.x

Differential Evolution (DE)

It is possible to pass the problem to other algorithm to get it solved. For example, if we would like to use Differential Evolution (DE), we can create an instance of DE (ypea_de) and set its parameters. Assume that, we are using the DE/best/2/bin, which means:

By calling solve method of DE and passing the problem into it, we can solve the optimization problem:

de_best_sol = de.solve(problem);

The best solution found by Differential Evolution is given by:

de_best_sol.solution.x

Types of Decision Variables

One of difficulties in modeling and defining optimization problems is to deal with different kinds of decision variables. In YPEA, there several types of decision variables are supported and makes the problem definition much more easier.

Supported variable types in YPEA, are listed below:

Real Variables, which are used to model real-valued (continuous) variables, in any size (scalar, vector, matrix, etc.), with any combination of lower and upper bounds.

Sample usage: most of real-world mathematical programming and optimization problems.

Integer Variables, which are used to model integer-valued (discrete) variables, in any size (scalar, vector, matrix, etc.), with any combination of lower and upper bounds.

Sample usage: Generalized Knapsack Problem.

Binary Variables, which are special case of integer variables, with lower bound set to 0, and upper bound set to 1;

Sample usage: Standard (Binary) Knapsack Problem.

Permutation Variables, which are used to model permutations of some items, and can include more than one permutation per variable (as rows of a matrix).

Selection Variables, which are used to model fixed-length selections of some items, and can include more than one selection per variable (as rows of a matrix).

Sample usage: Feature Selection.

Partition/Allocation Variables, which are used to partition a list of items into dijoint subsets (also known as allocation and assignment), and can include more than one partitioning per variable (as rows of matrices).