jacob
jacob

Reputation: 13

genetic algorithm with outer fitness function in Matlab

I am trying to use genetic algorithm in Matlab app in order to solve an optimization problem.i don't have the fitness function.what i have is a model from Vensim software.population enter to the Vensim model and the output is fitness function.we have 10 chromosome that have 10 value for fitness function.what kind of commands we can use in Matlab that match each fitness value with its own chromosome. for example: my new population is : [1 2 3;4 5 6;7 8 9] my fitness function values is: [100;200;300] i want calculate chromosome(1,2,3) with 100 values fitness function. or first rows of matrix population = first of rows matrix fitness function.

Upvotes: 0

Views: 592

Answers (1)

Yvon
Yvon

Reputation: 2993

population = [1 2 3;4 5 6;7 8 9];
fitness_function = [100;200;300];
for ii = 1:length(fitness_function)
    chromosome = population(ii,:);
    fitness_value = fitness_function(ii);
    result = calculate(chromosome, fitness_value);
end

Upvotes: 0

Related Questions