When I use GA app, how to put the constraints with absolute value
조회 수: 1 (최근 30일)
이전 댓글 표시
Now I using ga app.
I want to put the constraints in ga app.
That constraints is below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/781578/image.jpeg)
I can put the first constraint(g1), but my problem is second constraint(g2).
The second constraint(g2) have absolute value, how to apply it?
댓글 수: 0
답변 (1개)
Jaynik
2024년 4월 10일
Hi,
You can use the "abs" function for handling absolute values in the second constraint. Here is a sample code for the same:
g1 = sum(L(1:Ns) .* Ki(1:Ns)) / L - r1;
g2 = sum(abs(K(1:Ns-1) - K(2:Ns))) - r2;
You can read more about the "abs" function here:
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!