1593362160

**Introduction****Correctness Validation****A Brief Discussion on Performance Evaluation****Conclusion****References****Some Related Medium Posts**

Evolutionary and Metaheuristic optimization algorithms are considered as a subset of Artificial Intelligence (AI). These algorithms try to imitate nature mechanisms and solve an optimization problem. For example, the Genetic Algorithm (GA) uses inspired biological mechanisms such as reproduction, cross-over, selection, mutation, and recombination to find the best solution for an optimization problem. Another example can be an Imperialist Competitive Algorithm (ICA) where social mechanisms like domination, revolution, and colonization are used to find a solution [1]. Evolutionary algorithms are usually performing well in complex optimization problems where using classical approaches is mathematically difficult. They can easily deal with nonlinear problems without being stuck in local minimums.

To optimize a problem with an evolutionary optimization algorithm one can use a certified toolbox. However, for some algorithms, either there is no available certified toolbox or one may prefer to implement his/her own code with any program languages. In this situation, the most important questions are — How we can trust the written code? How we can validate the correctness of our implemented evolutionary or metaheuristic code?

In this post, some of the existing ways to check and validate the correctness of an implemented evolutionary optimization algorithm have been addressed briefly. In addition, a discussion regarding the performance evaluation of optimization algorithms is provided using an example of Ackley function.

There are different ways to check the correctness and accuracy of an implemented metaheuristic multi-objective optimization algorithm (e.g. Genetic Algorithm (GA) or Differential Evolution (DE)). The following approaches can be addressed briefly to check the correctness of the implemented optimization algorithm:

A) **Comparison with classical approaches:** In some problems, it can be possible to run both the classical approach and multi-variate GA to make sure the results are correct and accurate. However, in most cases, because of mathematical complexity using a classical approach for comparison is not possible.

B) **Using Well-known Benchmarks:** The correctness of the code can be also proven though existing benchmarks. The used algorithm can be validated via well-known benchmarks [2–6].

C) **Using Expert Idea:** An expert of the system can check the results and their rationality. They should all agree that the final results are logical. If for a problem exact minimum cost value is needed, then using an expert idea would not be convincing.

D) **Convergence:** The convergence of the implemented multi-objective genetic algorithm can be easily observed through the plot of cost vs. iterations. There are also other factors such as roundoff errors and local extrema that have the same perspective.

E) **Domination Factor:** The new generation of optimization algorithms such as NSGA-II, NSGA-III, and MOPSO usually have a function to separate dominant results from non-dominant one. So, all final results should be dominant and with a proper initial population, it is very rare to be trapped by a local minimum. However, there is no guarantee that they find the global minimum of the system. For more information regarding the domination please check [8].

#metaheuristics #artificial-intelligence #evolutionary-algorithms #optimization-algorithms #performance #algorithms

1593362160

**Introduction****Correctness Validation****A Brief Discussion on Performance Evaluation****Conclusion****References****Some Related Medium Posts**

Evolutionary and Metaheuristic optimization algorithms are considered as a subset of Artificial Intelligence (AI). These algorithms try to imitate nature mechanisms and solve an optimization problem. For example, the Genetic Algorithm (GA) uses inspired biological mechanisms such as reproduction, cross-over, selection, mutation, and recombination to find the best solution for an optimization problem. Another example can be an Imperialist Competitive Algorithm (ICA) where social mechanisms like domination, revolution, and colonization are used to find a solution [1]. Evolutionary algorithms are usually performing well in complex optimization problems where using classical approaches is mathematically difficult. They can easily deal with nonlinear problems without being stuck in local minimums.

To optimize a problem with an evolutionary optimization algorithm one can use a certified toolbox. However, for some algorithms, either there is no available certified toolbox or one may prefer to implement his/her own code with any program languages. In this situation, the most important questions are — How we can trust the written code? How we can validate the correctness of our implemented evolutionary or metaheuristic code?

In this post, some of the existing ways to check and validate the correctness of an implemented evolutionary optimization algorithm have been addressed briefly. In addition, a discussion regarding the performance evaluation of optimization algorithms is provided using an example of Ackley function.

There are different ways to check the correctness and accuracy of an implemented metaheuristic multi-objective optimization algorithm (e.g. Genetic Algorithm (GA) or Differential Evolution (DE)). The following approaches can be addressed briefly to check the correctness of the implemented optimization algorithm:

A) **Comparison with classical approaches:** In some problems, it can be possible to run both the classical approach and multi-variate GA to make sure the results are correct and accurate. However, in most cases, because of mathematical complexity using a classical approach for comparison is not possible.

B) **Using Well-known Benchmarks:** The correctness of the code can be also proven though existing benchmarks. The used algorithm can be validated via well-known benchmarks [2–6].

C) **Using Expert Idea:** An expert of the system can check the results and their rationality. They should all agree that the final results are logical. If for a problem exact minimum cost value is needed, then using an expert idea would not be convincing.

D) **Convergence:** The convergence of the implemented multi-objective genetic algorithm can be easily observed through the plot of cost vs. iterations. There are also other factors such as roundoff errors and local extrema that have the same perspective.

E) **Domination Factor:** The new generation of optimization algorithms such as NSGA-II, NSGA-III, and MOPSO usually have a function to separate dominant results from non-dominant one. So, all final results should be dominant and with a proper initial population, it is very rare to be trapped by a local minimum. However, there is no guarantee that they find the global minimum of the system. For more information regarding the domination please check [8].

#metaheuristics #artificial-intelligence #evolutionary-algorithms #optimization-algorithms #performance #algorithms

1626437280

Hello and Welcome back to this full course on Evolutionary Computation! In this post we will start Unit 6 of the course, Evolutionary Strategies. In the previous post we started and finished up Unit 5) Evolutionary Programming:

In this post we will cover the main differences between Evolutionary Strategies and standard Genetic Algorithms. We will also cover the main concepts of Evolutionary Strategies, namely the **Plus** and **Comma** Strategies for selection. To wrap up, we will apply our algorithm to find the **Pareto-Front** for a **Multi-Objective Problem**.

In addition, because Evolutionary Strategies is an extension of Evolutionary Programming, please see my previous post over Evolutionary Programming linked above.

- Differences between Evolutionary Strategies and standard Genetic Algorithms
- Selection Operators — Comma and Plus
- Multi-Objective Problem Statement
- Literature Paper: Multi-Objective Algorithm
- Evolutionary Strategy Algorithm
- Results
- Code
- Conclusion

#optimization #evolutionary-algorithms #genetic-algorithm #optimization-algorithms #pareto

1593358380

- A genetic algorithm (GA) is a higher level method to produce/ generate a sufficiently good solution to an optimization problem, inspired by the process of natural selection that belongs to the larger class of evolutionary algorithms (EA).
- Genetic algorithms are commonly used to generate high-quality solutions to optimization and search problems by relying on biologically inspired operators such as mutation, crossover and selection.
- John Holland introduced genetic algorithms in 1960 based on the concept of Darwin’s theory of evolution

**Evolutionary algorithms (EA)**:

In artificial intelligence (AI), an evolutionary algorithm (EA) is a subset of evolutionary computation, a generic population-based metaheuristic optimization algorithm. An EA uses mechanisms inspired by biological evolution, such as reproduction, mutation, recombination, and selection.

Evolutionary algorithms have three main characteristics:

· **Population-Based**: Evolutionary algorithms are to optimize a process in which current solutions are bad to generate new better solutions. The set of current solutions from which new solutions are to be generated is called the population.

· **Fitness-Oriented**: If there are some several solutions, how to say that one solution is better than another? There is a fitness value associated with each individual solution calculated from a fitness function. Such fitness value reflects how good the solution is.

· **Variation-Driven**: If there is no acceptable solution in the current population according to the fitness function calculated from each individual, we should make something to generate new better solutions. As a result, individual solutions will undergo a number of variations to generate new solutions.

In

a genetic algorithm, a population of candidate solutions (called individuals, creatures, or phenotypes) to an optimization problem is evolved toward better solutions. Each candidate solution has a set of properties (its chromosomes or genotype) which can be mutated and altered; traditionally, solutions are represented in binary as strings of 0s and 1s, but other encodings are also possible.

The process of natural selection starts with the selection of fittest individuals from a population. They produce offspring which inherit the characteristics of the parents and will be added to the next generation. If parents have better fitness, their offspring will be better than parents and have a better chance at surviving. This process keeps on iterating and at the end, a generation with the fittest individuals will be found.

**Six phases are considered in a genetic algorithm:**

· Initial population

· Fitness function

· Selection

· Crossover

· Mutation

· Termination

flowchart for process in a genetic algorithm

#evolutionary-algorithms #optimization #genetic-algorithm #machine-learning #ai #algorithms

1624867080

Algorithm trading backtest and optimization examples.

#algorithms #optimization examples #algorithm trading backtest #algorithm #trading backtest

1624496700

While writing code and algorithms you should consider tail call optimization (TCO).

The tail call optimization is the fact of optimizing the recursive functions in order to avoid building up a tall **call stack**. You should as well know that some programming languages are doing tail call optimizations.

For example, Python and Java decided to don’t use TCO. While JavaScript allows to use TCO since ES2015-ES6.

Even if you know that your favorite language support natively TCO or not, I would definitely recommend you to assume that your compiler/interpreter will not do the work for you.

There are two famous methods to do a tail call optimization and avoid tall call stacks.

As you know recursions are building up the call stack so if we avoid such recursions in our algorithms it will will allow us to save on the **memory usage**. This strategy is called the **bottom-up** (we start from the beginning, while a recursive algorithm starts from the end after building a stack and works backwards.)

Let’s take an example with the following code (top-down — recursive code):

```
function product1ToN(n) {
return (n > 1) ? (n * product1ToN(n-1)) : 1;
}
```

As you can see this code has a problem: it builds up a **call stack** of size O(n), which makes our total memory cost O(n). This code makes us vulnerable to a **stack overflow error**, where the call stack gets too big and runs out of space.

In order to optimize our example we need to go bottom-down and remove the recursion:

```
function product1ToN(n) {
let result = 1;
for (let num = 1; num <= n; num++) {
result *= num;
}
return result;
}
```

This time we are not stacking up our calls in the **call stack**, and we do use a O(1) space complexity(with a O(n) time complexity).

#memoization #programming #algorithms #optimization #optimize