genetic algorithm matlab minimization

3 views (last 30 days)
Anass
Anass on 11 Nov 2015
Commented: Anass on 12 Nov 2015
Hi, I would like to use the Optimization-ToolBox of Matlab that provide a tool for the Genetic Algorithms. I have a small equation (Score= alpha*(\sum(L[i])^(1/alpha) + Beta*(\sum(R[i])^(1/Beta)) that compute a score where L and R are vectors of values that I computed before and alpha and beta are parameters that I want to optimize via the GA. The constraint is that the scores should be close to another vector of scores called ground truth. We can formalize this constraint by : " |score - ground_truth_score|_2^{2}=0"
So for every L[i] and R[i], an Alpha and Beta would optimize the constraint defined before.
I'm trying to discover the GA in Matlab, however, I don't know how to formalize the constraint with the fitness function (the equation).

Answers (1)

Alan Weiss
Alan Weiss on 11 Nov 2015
Perhaps the constrained minimization example will help.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Comments
Anass
Anass on 11 Nov 2015
Edited: Anass on 11 Nov 2015
Hi, thank you for your response, but i've already seen this example, they are talking about the constraint on the input data (variable x of the function), however, in my case, i'm talking about the constraint on the value returned by the function. This one must be close to my ground truth. I don't find a way to make a constraint on this.
Anass
Anass on 12 Nov 2015
I made this objective function to manage the minimization of my problem, however i'm not sure if it's the right answer:
function y=parametrized_fitness_fct(x,ground_truth_score)
y=x(1)*(L^(1/x(1))) + x(2)*(R^(1/x(2))) + ground_truth_score;
% ground_truth_score, L and R are single values
end
FitnessFunction =@(x) parametrized_fitness_fct(x,ground_truth_score);
[x,score] = ga(FitnessFunction,numberOfVariables)%numberOfVariables=2
%x will be a vector containing the searched values "alpha and beta",
%and score is the score optimized to be close to the ground_truth_score

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!