When I use GA app, how to put the constraints with absolute value

1 visualización (últimos 30 días)
SeungJu Choi
SeungJu Choi el 28 de Oct. de 2021
Respondida: Jaynik el 10 de Abr. de 2024
Now I using ga app.
I want to put the constraints in ga app.
That constraints is below.
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?

Respuestas (1)

Jaynik
Jaynik el 10 de Abr. de 2024
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!

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by