You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.Rmd
+55-10
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
---
2
2
output: github_document
3
+
bibliography: references.bib
3
4
---
4
5
5
6
<!-- README.md is generated from README.Rmd. Please edit that file -->
@@ -21,9 +22,9 @@ knitr::opts_chunk$set(
21
22
22
23
<!-- badges: end -->
23
24
24
-
Genetic algorithms (GAs) are metaheuristic optimization techniques inspired by the principles of natural selection and evolution. They operate on a population of potential solutions, applying genetic operators such as selection, crossover, and mutation to evolve better solutions over successive generations.
25
+
Genetic algorithms (GAs) are metaheuristic optimization techniques inspired by the principles of natural selection and evolution. They operate on a population of potential solutions, applying genetic operators such as selection, crossover, and mutation to evolve better solutions over successive generations[@whitley1994].
25
26
26
-
GAs are particularly useful for optimizing complex, non-linear functions with multiple local optima, where traditional gradient-based methods may fail.
27
+
GAs are particularly useful for optimizing complex, non-linear functions with multiple local optima, where traditional gradient-based methods may fail[@holland1992; @goldberg1988].
27
28
28
29
We come out with a simple example to explore how these components work together in our quadratic function optimization problem using `genetic.algo.optimizeR` package.
29
30
@@ -62,7 +63,55 @@ Here's a breakdown of the aim and the results:
62
63
63
64
After multiple generations of repeating these steps, the genetic algorithm aims to converge towards an optimal or near-optimal solution. In this example, since it's simple and the solution space is small, we could expect the algorithm to converge relatively quickly towards the optimal solution $x = 2$, where $f(x) = 0$.
@@ -121,7 +170,7 @@ The above example illustrates the process of a genetic algorithm, where individu
121
170
(Note: the values are random and the population should be highly diversified)
122
171
- The space of x value is kept integer type and on range from 0 to 3,for simplification.
123
172
124
-
```{r}
173
+
```{r population}
125
174
population <- c(1, 3, 0)
126
175
population
127
176
```
@@ -144,7 +193,7 @@ $$
144
193
145
194
In R, we write:
146
195
147
-
```{r}
196
+
```{r f_function}
148
197
a <- 1
149
198
b <- -4
150
199
c <- 4
@@ -295,7 +344,7 @@ By understanding these fundamental concepts and their implementation, we can tak
295
344
296
345
### Multi-objective optimization
297
346
298
-
While our example focuses on single-objective optimization, genetic algorithms are particularly powerful for multi-objective problems. In such cases, the concept of Pareto optimality is used to evaluate solutions, and techniques like NSGA-II (Non-dominated Sorting Genetic Algorithm II) can be employed.
347
+
While our example focuses on single-objective optimization, genetic algorithms are particularly powerful for multi-objective problems. In such cases, the concept of Pareto optimality is used to evaluate solutions, and techniques like NSGA-II (Non-dominated Sorting Genetic Algorithm II) can be employed[@deb2002].
299
348
300
349
### Adaptive parameter control
301
350
@@ -319,7 +368,3 @@ I would encourage the users to experiment with different parameter settings and
319
368
320
369
## References
321
370
322
-
1. Goldberg, D. E. (1989). Genetic Algorithms in Search, Optimization and Machine Learning. Addison-Wesley.
323
-
2. Holland, J. H. (1992). Adaptation in Natural and Artificial Systems. MIT Press.
324
-
3. Whitley, D. (1994). A genetic algorithm tutorial. Statistics and Computing, 4(2), 65-85
325
-
4. Deb, K., Pratap, A., Agarwal, S., & Meyarivan, T. A. M. T. (2002). A fast and elitist multiobjective genetic algorithm: NSGA-II. IEEE Transactions on Evolutionary Computation, 6(2), 182-197.
Copy file name to clipboardexpand all lines: inst/tutorials/theoretical_background/theory.Rmd
+28-7
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Theory background"
2
+
title: "Tutorial on GAs"
3
3
output: learnr::tutorial
4
4
runtime: shiny_prerendered
5
5
---
@@ -11,7 +11,28 @@ library(dplyr)
11
11
knitr::opts_chunk$set(echo = FALSE)
12
12
```
13
13
14
-
## 1. Initialize Population:
14
+
## Theoretical Background
15
+
16
+
Genetic algorithms (GAs) are metaheuristic optimization techniques inspired by the principles of natural selection and evolution. They operate on a population of potential solutions, applying genetic operators such as selection, crossover, and mutation to evolve better solutions over successive generations.
17
+
18
+
The key components of a genetic algorithm include:
19
+
20
+
1.**Encoding**: Representing potential solutions as "chromosomes"
21
+
2.**Fitness Function**: Evaluating the quality of solutions
22
+
3.**Selection**: Choosing individuals for reproduction based on fitness
23
+
4.**Crossover**: Combining genetic information from parents to create offspring
24
+
5.**Mutation**: Introducing random changes to maintain genetic diversity
25
+
6.**Replacement**: Updating the population with new individuals
26
+
27
+
GAs are particularly useful for optimizing complex, non-linear functions with multiple local optima, where traditional gradient-based methods may fail.
28
+
29
+
## Aim
30
+
31
+
Our primary objective is to optimize the quadratic function \( f(x) = x^2 - 4x + 4 \) to find the value of \( x \) that minimizes the function. This function has a global minimum at \( x = 2 \), which we aim to discover using our genetic algorithm implementation.
32
+
33
+
## Method
34
+
35
+
### 1. Initialize Population:
15
36
16
37
- Start with a population of individuals: X1(x=1), X2(x=3), X3(x=0).\
17
38
(Note: the values are random and the population should be highly diversified)
Copy file name to clipboardexpand all lines: vignettes/optimize_function_with_GA.Rmd
+1-1
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ The application of genetic algorithms (GAs) offers a powerful approach to optimi
24
24
25
25
Genetic algorithms are inspired by the principles of natural selection and genetics. They are widely utilized in optimization problems where traditional methods may falter due to the complexity of the search space. We will illustrate the step-by-step implementation of a genetic algorithm to minimize the quadratic function \( f(x) = x^2 - 4x + 4 \). The objective is to identify the value of \( x \) that yields the minimum value of the function, thereby providing insights into the capabilities and workings of GAs.
0 commit comments