How to skip an optimization iteration if the constraint is violated ?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Matthieu Bernard
il 1 Gen 2021
Commentato: Weihan Lin
il 31 Ago 2021
Hello, I am trying to minimizing an objectif function with Surrogate optimisation.
The objectif function depends on 2 parameters
, having the following lower and upper limits:
lb = [10, 2 ];
ub = [20, 4 ];
And I have a constraint
, which, if it is not complied with, prevents the proper functioning of the function objective. The problem with surrogate optimisation is that the constraint is only check after the objectif function was evaluated. So my question is "how can I forbid certain combinations of parameters"? As proposed in this answer (https://nl.mathworks.com/matlabcentral/answers/49677-how-to-make-optimization-to-redo-or-skip-one-iteration), I tried to add in my objectif function, an if statement:
if
then output.Fval = NaN
Hower this does not seems to work for surrogate optimisation. So if you have any idea how i could solve this problem I am a taker. Thanks.
0 Commenti
Risposta accettata
Matt J
il 1 Gen 2021
Modificato: Matt J
il 1 Gen 2021
And I have a constraint , which, if it is not complied with, prevents the proper functioning of the function objective.
In your objective function, make the execution of the main routine conditional on the constraints being satisfied.
if x1<3*x2
fval=inf; return
else
fval=...%evaluate normaly
end
or you can post-correct the output,
fval=%evaluate normally
if ~(isfinite(fval)&&isreal(fval))
fval=inf; return
end
21 Commenti
Walter Roberson
il 31 Ago 2021
If the optimization returns nan in that setup, it means that the optmizer did not find even one point that satisfied all of your constraints.
Weihan Lin
il 31 Ago 2021
Yeah, I see. It couldn't find any feasible point when the population size is small. I change th population size from 50 to 1000 and only one point was found in the feasible region after 30 iterations. I probably will increase the population size more and see if the results will get any better and I'm so appreciate for your help.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Surrogate Optimization in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!