Non linear constrain to multi objective integer genetic algorithm

3 visualizzazioni (ultimi 30 giorni)
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

Risposte (1)

Matt J
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
Sotiris
Sotiris 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. You are right about the consecutive x(i) and as I want every element in the array to be uninque I will adjust the code accordingly.
However not even that constrain is satisfied.
Matt J
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
ans = logical
0
For uniqueness, you would need,
A=ones(numel(x))-eye(numel(x));
nlcon=@(x)Nonlcon(x,A);
nlcon(x) %violated
ans = 6x6
0 0 1 0 1 0 0 0 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 0 1 0 1 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
nlcon(randperm(6)) %satisfied
ans = 6x6
0 -2 0 -1 -1 0 -2 0 -3 -4 0 -1 0 -3 0 0 -2 -1 -1 -4 0 0 -3 -2 -1 0 -2 -3 0 0 0 -1 -1 -2 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
function [c,ceq]=Nonlcon(x,A)
ceq=[];
c=A-abs(x-x');
end

Accedi per commentare.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by