Skip to contents

Metaheuristics is the module binding that OptimizationMetaheuristics exports: a list with the parts of Metaheuristics.jl used with its algorithms, reached as Metaheuristics$Options(...). It contains

Usage

Metaheuristics

Format

A named list of functions.

Details

  • the algorithms (also exported on their own, see metaheuristics_single, metaheuristics_multi and metaheuristics_combinatorial) and NSGA2(N, eta_cr, p_cr, eta_m, p_m), the NSGA2 of Metaheuristics.jl;

  • Options(x_tol, f_tol, g_tol, h_tol, f_tol_rel, f_tol_abs, f_calls_limit, iterations, time_limit, store_convergence, parallel_evaluation, seed, ...) and Information(f_optimum, x_optimum);

  • the termination criteria CheckConvergence(), RobustConvergence(), AbsoluteFunctionConvergence(), RelativeFunctionConvergence(), SmallStandardDeviation(), RelativeParameterConvergence() and Termination(checkall, checkany);

  • optimize(f, bounds, method), which minimizes f(x) in the box bounds (a matrix with the rows lb and ub) and returns the final state, and boxconstraints(lb, ub);

  • the readers of a state (or of a solution of solve()) minimizer, minimum, positions, fvals, nfes, pareto_front, get_non_dominated_solutions, termination_status_message, and non_dominated_sort (the ranks of a population), gen_ref_dirs(m, H) and gen_weights(m, H) (the points of the simplex);

  • the operators of GA(): RandomInBounds, RandomPermutation, RandomBinary, TournamentSelection, RouletteWheelSelection, BiasedSelection, SBX, UniformCrossover, BinomialCrossover, OrderCrossover, PolynomialMutation, BitFlipMutation, SlightMutation, InsertRandomMutation, GenerationalReplacement, ElitistReplacement and RankAndCrowding;

  • the parts of the local search methods: BestImproveSearch, FirstImproveSearch, TwoOptNeighborhood(k), GreedyRandomizedConstructor(candidates, instance, alpha, compute_cost), SequentialChange and CyclicChange.

Examples

set.seed(1)
res <- Metaheuristics$optimize(function(x) sum(x^2), rbind(c(-1, -1), c(1, 1)),
                              ECA(options = Metaheuristics$Options(iterations = 50)))
Metaheuristics$minimum(res) < 1e-3
#> [1] TRUE
Metaheuristics$gen_ref_dirs(2, 4)
#> [[1]]
#> [1] 0 1
#> 
#> [[2]]
#> [1] 0.25 0.75
#> 
#> [[3]]
#> [1] 0.5 0.5
#> 
#> [[4]]
#> [1] 0.75 0.25
#> 
#> [[5]]
#> [1] 1 0
#>