How to use Genetic Algorithm (GA) for multi-objective function (Dynamic Optimization)?
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
I need to optimize this multiobjective function using GA:
Z=min(2X+Y);
X= sum (a1+b1+c1-d1+(N1/S))
Y= sum (a2+b2+c2-d2+(N2/S))
All other variables are known (however, dynamically changed), excepted (b1,b2) which needed to optimized to get the optimal value of (Z)
1 Comment
Mario CASTRO GAMA
on 18 Jan 2018
Accepted Answer
Alan Weiss
on 11 Jan 2018
This does not look like a multiobjective problem to me. You have a single scalar objective Z. Furthermore, it seems to be an unbounded problem, with no finite minimum (I mean it seems that b1 and b2 could take the values -Inf, and then Z would also have the value -Inf, which is the minimum).
If I misunderstand, feel free to clarify.
Alan Weiss
MATLAB mathematical toolbox documentation
11 Comments
Alan Weiss
on 12 Jan 2018
I am afraid that I find your comments unintelligible. Do you have just one objective, Z? If so, why do you want to maximize b1 and b2? How do X and Y depend on b1 and b2 other than through the linear expressions you already gave? And why does it matter, if all you ultimately want to do is minimize Z?
In order to make your problem clear, please give a concise statement of the objective or objectives (if different from what you already gave) and of any constraints that might exist.
Alan Weiss
MATLAB mathematical toolbox documentation
Sherif Shokry
on 15 Jan 2018
Edited: Walter Roberson
on 15 Jan 2018
Mr.Alan Weiss, Regarding your 1st comment the objective function
Z=min(2X+Y);
X= sum (a1+b1+c1-d1+(N1/S)) b1 subject to (0,upper limit)
Y= sum (a2+b2+c2-d2+(N2/S)) b2 subject to (0,upper limit)
to ensure that b1 and b2 would not take the values -Inf,
That is not multi-objective. This is minimization of
2 * sum (a1+b1+c1-d1+(N1/S)) + sum (a2+b2+c2-d2+(N2/S))
with lower bound [0, 0] and upper bound whatever limits are appropriate.
Sherif Shokry
on 15 Jan 2018
Thank you for your quick response. If it's not a muti-objective function, could you please recommend me the best way to solve this fitness function. Note: this fitness function for dynamic iteration
function y = fitness(b, a, c, d, N, S)
a1 = a(1); a2 = a(2);
b1 = b(1); b2 = b(2);
c1 = c(1); c2 = c(2);
d1 = d(1); d2 = d(2);
y = 2 * sum(a1+b1+c1-d1+(N1./S)) + sum(a2+b2+c2-d2+(N2./S));
together with calling your favorite minimizer with
... define a1, a2, c1, c2, d1, d2, N, S. Then
fun = @(b) fitness(b, [a1,a2], [c1,c2], [d1,d2], N, S);
A = []; b = [];
Aeq = []; beq = [];
lb = [0 0]; ub = [appropriate upper bounds];
For example,
b0 = rand(1,2);
b = fmincon(fun, b0, A, b, Aeq, beq, lb, ub);
Walter Roberson
on 15 Jan 2018
This assumes that a1, a2, c1, c2, d1, d2 are all scalars and that the vector is either N or S.
Sherif Shokry
on 22 Jan 2018
Thank you Mr.Roberson, I got this error when I tried to recall the dynamic variables for the fitness function from the main.m file. Please kindly find my fitness.m file
Please attach all of your code as individual files (posted the way you have, I cannot tell where the files begin and end.)
I do not understand what you mean by saying that you are trying to recall the dynamic variables for the fitness function from the main.m file? Variables you calculate in the fitness function are in the workspace of the fitness function and are not available to the main function.
Perhaps you should consider an arrangement such as:
function y = fitness(b, a, c, d, N, S)
[variable1, variable2, variable3...] = calculate_intermediate_variables(b, a, c, d, N, S);
y = some_function(variable1, variable2, variable3);
And then when you have found the best fit and need the temporary variables that would be calculated for it, call
[variable1, variable2, variable3...] = calculate_intermediate_variables(best_b, a, c, d, N, S);
This arrangement is a lot easier than arranging to have fitness store the variables where your main routine can find them.
Sherif Shokry
on 23 Jan 2018
Thank you for your kind response. I would like to attach here the main.m file named (VISSIM.COM1) and the fitness.m file named (extension). However, let me draw your attention it may not be working since this code is manipulating a simulation software via COM interface. Also, let me clarify the meaning of (recall the variables values), this process aims to input the variable values into the fitness function since this variables is in a dynamic iteration and the fitness function is done iteratively
Sherif Shokry
on 25 Jan 2018
I think the function (fmincon) is not appropriate to my case. In my case I'm seeking (b) variables which achieve the optimal (y). However, if I understood correctly (fmincon) finds (y) variables that achieve optimal (b).
Walter Roberson
on 25 Jan 2018
"However, if I understood correctly (fmincon) finds (y) variables that achieve optimal (b)."
No, fmincon seeks the inputs that give the lowest outputs.
However, fmincon is a local minimizer -- it gets stuck in local minima.
"this process aims to input the variable values into the fitness function since this variables is in a dynamic iteration and the fitness function is done iteratively"
More Answers (0)
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Tags
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)