# Metaheuristics - an Intuitive Package for Global Optimization

**Author: Jesus Mejía (@jmejia8)**

High performance algorithms for optimization purely coded in a high performance language.

## Introduction

Optimization is one of the most common task in the scientific and industry field but real-world problems require high-performance algorithms to optimize non-differentiable, non-convex, dicontinuous functions. Different metaheuristics algorithms have been proposed to solve optimization problems but without strong assumptions about the objective function.

This package implements state-of-the-art metaheuristics algorithms for global optimization. The aim of this package is to provide easy to use (and fast) metaheuristics for numerical global optimization.

## Installation

Open the Julia (Julia 1.1 or Later) REPL and press `]`

to open the Pkg prompt. To add this package, use the add command:

`pkg> add Metaheuristics`

Or, equivalently, via the `Pkg`

API:

`julia> import Pkg; Pkg.add("Metaheuristics")`

## Quick Start

Assume you want to solve the following minimization problem.

Minimize:

\[f(x) = 10D + \sum_{i=1}^{D} x_i^2 - 10\cos(2\pi x_i)\]

where $x\in[-5, 5]^{D}$, i.e., $-5 \leq x_i \leq 5$ for $i=1,\ldots,D$. $D$ is the dimension number, assume $D=10$.

### Solution

Firstly, import the Metaheuristics package:

`using Metaheuristics`

Code the objective function:

`f(x) = 10length(x) + sum( x.^2 - 10cos.(2π*x) )`

Instantiate the bounds, note that `bounds`

should be a $2\times 10$ `Matrix`

where the first row corresponds to the lower bounds whilst the second row corresponds to the upper bounds.

```
D = 10
bounds = [-5ones(D) 5ones(D)]'
```

Approximate the optimum using the function `optimize`

.

`result = optimize(f, bounds)`

Optimize returns a `State`

datatype which contains some information about the approximation. For instance, you may use mainly two functions to obtain such approximation.

```
@show minimum(result)
@show minimizer(result)
```

## Contents

- Tutorial
- Minimization Problem
- Providing Information
- Common Settings
- Choose a Metaheuristic
- Optimize
- Get the Results
- Get Information about the Resulting Population
- Bonus
- Summary
- Examples
- Single-Objective Optimization
- Providing Initial Solutions
- Constrained Optimization
- Multiobjective Optimization
- Modifying an Existing Metaheuristic
- Algorithms
- Evolutionary Centers Algorithm
- Differential Evolution
- Particle Swarm Optimization
- Artificial Bee Colony
- MOEA/D-DE
- Gravitational Search Algorithm
- Simulated Annealing
- Whale Optimization Algorithm
- NSGA-II
- NSGA-III
- SMS-EMOA
- Problems
- Performance Indicators
- Generational Distance
- Generational Distance Plus
- Inverted Generational Distance
- Inverted Generational Distance Plus
- Spacing Indicator
- Covering Indicator ($C$-metric)
- Hypervolume
- $\Delta_p$ (Delta $p$)
- Visualization
- API References

## Related packages

- Evolutionary.jl: Genetic algorithms, "Evolution" Strategies, among others.
- GeneticAlgorithms.jl: Genetic Algorithms
- BlackBoxOptim.jl: Optimizers for black-box optimization (no information about the objective function).
- NODAL.jl: Stochastic Local Search methods, such as Simulated Annealing and Tabu Search.
- Other Packages.