Reputation: 1
Good day
I'm working with Genetic Algorithms in MATLAB using the Global Optimization Toolbox. I'm quite experienced in this area. My question is as follows:
How do I specify constraints that are not just reliant on the input variable. I.e. a constrain that may be a function of the output or an intermediate variable.
NOTE: The output of this system is calculated from a "black box" (it's a PSS SINCAL simulation).
At this stage I've been using a workaround - making the fitness function a very high value when the output is not within the constraints. Looking for a more elegant solution.
Thank you
Elvis
Upvotes: 0
Views: 1561
Reputation: 1
You could use nested functions for your objective and constraint functions. That would allow you to have MATLAB variables (other than the input variables) that are visible to both the objective and constraint functions.
This example uses nested functions in order to use results from running a simulation in both the objective and constraint functions. It also shows how to check to see if the simulation needs to be run again, which is necessary if either the objective function or constraint function is called with new values for the input variables.
Upvotes: 0