How to display the value of a specific component of the objective function after computation is done?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
William
el 20 de En. de 2023
Comentada: William
el 30 de En. de 2023
Good evening,
I was looking through Matlab documentation for genetic algorithm and I found the following example: "Plan Nuclear Fuel Disposal Using Multiobjective Optimization" https://www.mathworks.com/help/gads/multiobjective-nuclear-fuel-disposal.html
After reading through that example, I have a question. Is it possible to display/know the value of a specific component of the objective function for a certain point on the Pareto front after the computation is over?
For instance, if I want to know the value of the objective function "cost" for the first point on the front, the command is:
display(sol(1).cost)
But through this command I get the total cost calculated for the first point.
What if I want to know the value for the third cost component? Is there any way to determine it or not? I tried the following: display(sol(1).cost(3)) but apparently it doesn't work.
Do you have any pointers?
I hope my question is clear. If you need any clarification let me know. I will gladly answer any question and I will be really thankful for any suggestions.
Kind regards,
William
2 comentarios
Walter Roberson
el 22 de En. de 2023
(I am trying to investigate this, but the script is running very slowly on my machine :( :( :( )
Respuesta aceptada
Alan Weiss
el 23 de En. de 2023
I'd be very interested to know what you think of the nuclear fuel disposal example.
But to answer your question, let's look at an example that is faster to compute.
x = optimvar("x",1,2,LowerBound=-50,UpperBound=50);
fun(1) = x(1)^4 + x(2)^4 + x(1)*x(2) - x(1)^2*x(2)^2 - 9*x(1)^2;
fun(2) = x(1)^4 + x(2)^4 + x(1)*x(2) - x(1)^2*x(2)^2 + 3*x(2)^3;
prob = optimproblem("Objective",fun);
rng default % For reproducibility
sol = solve(prob)
Look at the two objective components at the first solution point.
t = sol(1).Objective
Look at just the second objective component at the first solution point.
ob = sol(1).Objective(2)
This is exactly what you tried, and it works fine for me.
Alan Weiss
MATLAB mathematical toolbox documentation
13 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Surrogate Optimization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!