I am using genetic algorithm optimization toolbox. i have done evrything i am also getting output and all. but i want is i want the output in particular range.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
harsh Brar
am 9 Mär. 2022
Bearbeitet: harsh Brar
am 14 Mär. 2022
For example
function t=compST(input)
x(1) = input(1);
x(2) = input(2)
x(3) = input(3)
x(4) = input(4)
x(5) = input(5)
t = 122.14-0.84.*x(1)-0.42.*x(2)+0.34.*x(3)-0.09.*x(4)+363.77.*x(5);
output = [t]
here t is compressive strenth . i want the t in range of 40-80 MPA range how can i do that
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 9 Mär. 2022
Bearbeitet: Walter Roberson
am 10 Mär. 2022
If you are using ga() then the above link shows you how to halt if the function value is within a specified value.
4 Kommentare
Walter Roberson
am 10 Mär. 2022
options = optimoptions('ga', 'FitnessLimit', 400, 'MaxGenerations', 1e5);
A = []; b = []; Aeq = []; beq = []; lb = []; ub = []; nonlcon = [];
obj = @(x) (compST(x)-60).^2;
bestx = ga(obj, 5, A, b, Aeq, beq, lb, ub, nonlcon, options);
display(bestx)
display(compST(bestx))
function t=compST(x)
t = 122.14-0.84.*x(1)-0.42.*x(2)+0.34.*x(3)-0.09.*x(4)+363.77.*x(5);
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!