Non linear constrain to multi objective integer genetic algorithm
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello all,
I am trying to set up a multibjective optimization in ga that the possible candidates for the x array have different values (it is an optimal sensor placement problem thus I cannot have the same sensor in the same grid more than once).
When I use the single objcetive function "ga" and define nonlcon = @(x) deal(any(abs(diff(x(1:length(lb)/2))) ~= 1), []) the optimization works fine. (only the first half of the array regards the sensors the rest is the strain component so the values dont have to be unique)
However for the case of "gamultiobj" the non linear constrain does not seem to be taken into account.
Have you ever had such an issue?
Thanks
0 Commenti
Risposte (1)
Matt J
il 26 Apr 2024
Modificato: Matt J
il 26 Apr 2024
Is the idea that x(1:end/2) contain unique integers? I don't see how the given constraint would ensure that. The diff() function would only detect whether two consecutive x(i) are the same or not. If the idea is to have no consecutive repetitions, then you should have,
nonlcon = @(x) deal( 1-abs(diff(x(1:end/2))) , [])
2 Commenti
Matt J
il 26 Apr 2024
Yes thats the idea but that is ensured by the "intcon" argument that follows the non linear constarins in the matlab function
If you're anticipating that "integer constraints" plus "no consecutive repetitions" = "uniqueness" then that's wrong. Here is a simple sequence of non-unique integers satisfying your constraints,
x=[1,2,1,2,1,2];
any( abs(diff(x)) ~= 1) %satisfied
For uniqueness, you would need,
A=ones(numel(x))-eye(numel(x));
nlcon=@(x)Nonlcon(x,A);
nlcon(x) %violated
nlcon(randperm(6)) %satisfied
function [c,ceq]=Nonlcon(x,A)
ceq=[];
c=A-abs(x-x');
end
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!