Non linear constrain to multi objective integer genetic algorithm

조회 수: 8 (최근 30일)
Sotiris
Sotiris 2024년 4월 26일
댓글: Matt J 2024년 4월 26일
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

답변 (1개)

Matt J
Matt J 2024년 4월 26일
편집: Matt J 2024년 4월 26일
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
Sotiris
Sotiris 2024년 4월 26일
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 2024년 4월 26일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by