Minimum Finder  1.0
Find the minimum of one multi-dimss function
Loading...
Searching...
No Matches
structs.h
Go to the documentation of this file.
1/*
2@Author: Gilbert Young
3@Time: 2024/09/19 08:56
4@File_name: structs.h
5@Description:
6Header file containing the definitions of data structures used in the optimization algorithms:
71. Individual: structure to store coordinates and fitness for the Genetic Algorithm.
82. DefaultParameters: structure for default parameters for all algorithms.
93. Result: structure to store the optimization results.
10*/
11
12#ifndef STRUCTS_H
13#define STRUCTS_H
14
15#include <vector>
16
17// Structure to store coordinates and fitness for Genetic Algorithm
19{
20 double x;
21 double y;
22 double fitness;
23
24 // Constructor for easier initialization
25 Individual(double x_val = 0, double y_val = 0) : x(x_val), y(y_val), fitness(0) {}
26};
27
28// Structure for default parameters
30{
31 // Initial points
32 double x0 = 0.0;
33 double y0 = 0.0;
34
35 // Steepest Descent parameters
36 double alpha_sd = 0.0050;
37 double tol_sd = 1e-8;
38 int maxIter_sd = 100000;
39
40 // Conjugate Gradient parameters
41 double tol_cg = 1e-8;
42 int maxIter_cg = 100000;
43
44 // Simulated Annealing parameters
45 double T0_sa = 2000.0;
46 double Tmin_sa = 1e-8;
47 double alpha_sa = 0.99;
48 int maxIter_sa = 200000;
49
50 // Genetic Algorithm parameters
52 int generations_ga = 5000;
53 double mutationRate_ga = 0.02;
54 double crossoverRate_ga = 0.8;
55};
56
57// Structure to store optimization results
58struct Result
59{
60 double x;
61 double y;
62 double f;
64 double duration; // in seconds
65};
66
67#endif // STRUCTS_H
double crossoverRate_ga
Definition structs.h:54
int populationSize_ga
Definition structs.h:51
double alpha_sd
Definition structs.h:36
double alpha_sa
Definition structs.h:47
double mutationRate_ga
Definition structs.h:53
double x
Definition structs.h:20
Individual(double x_val=0, double y_val=0)
Definition structs.h:25
double fitness
Definition structs.h:22
double y
Definition structs.h:21
double duration
Definition structs.h:64
double f
Definition structs.h:62
double y
Definition structs.h:61
double x
Definition structs.h:60
int iterations
Definition structs.h:63