Custom data types and constraints with genetic algorithms
Hello everybody,
I’m trying to implement a genetic algorithm that works with custom data types in MATLAB. Each chromosome of the population is made of two parts: a string and a vector of integers.
The string part is the binary representation of a number and I need to perform admissibility checks over it after crossover and mutation operations in order to avoid that the number represented could exceed a certain value.
I’ve followed this example for working with custom data types but I still have a question: how do I pass the max value as parameter to crossover and mutation functions? And, more generally, is there a way to pass any extra parameter to these functions?
For now I’m using global variables, but this feels a very bad idea and I’d like to find out which is the right way to do what I need.
Thanks in advance!Hello everybody,
I’m trying to implement a genetic algorithm that works with custom data types in MATLAB. Each chromosome of the population is made of two parts: a string and a vector of integers.
The string part is the binary representation of a number and I need to perform admissibility checks over it after crossover and mutation operations in order to avoid that the number represented could exceed a certain value.
I’ve followed this example for working with custom data types but I still have a question: how do I pass the max value as parameter to crossover and mutation functions? And, more generally, is there a way to pass any extra parameter to these functions?
For now I’m using global variables, but this feels a very bad idea and I’d like to find out which is the right way to do what I need.
Thanks in advance! Hello everybody,
I’m trying to implement a genetic algorithm that works with custom data types in MATLAB. Each chromosome of the population is made of two parts: a string and a vector of integers.
The string part is the binary representation of a number and I need to perform admissibility checks over it after crossover and mutation operations in order to avoid that the number represented could exceed a certain value.
I’ve followed this example for working with custom data types but I still have a question: how do I pass the max value as parameter to crossover and mutation functions? And, more generally, is there a way to pass any extra parameter to these functions?
For now I’m using global variables, but this feels a very bad idea and I’d like to find out which is the right way to do what I need.
Thanks in advance! genetic algorithm MATLAB Answers — New Questions