How to display the value of a specific component of the objective function after computation is done?

2 visualizzazioni (ultimi 30 giorni)
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 Commenti
William
William il 22 Gen 2023
@Walter Roberson unfortunately, I'm aware that that script runs very slowly. In the meantime I tried looking everywhere for similar questions but I couldn't find anything. Please, let me know if you manage to find out something about it. I will greatly appreciate it.

Accedi per commentare.

Risposta accettata

Alan Weiss
Alan Weiss il 23 Gen 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)
Solving problem using gamultiobj. Optimization terminated: average change in the spread of Pareto solutions less than options.FunctionTolerance.
sol =
1×18 OptimizationValues vector with properties: Variables properties: x: [2×18 double] Objective properties: Objective: [2×18 double]
Look at the two objective components at the first solution point.
t = sol(1).Objective
Cannot find function "solution.mlx".

Error in ()
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 Commenti

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by