0

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

  • Isn't some form of penalization also the way Matlab's `ga` handles constraints? And more importantly, doesn't your penalty method work, or are your results often constraint-violated? – Rody Oldenhuis Jun 07 '13 at 09:28
  • Can the result be written as a vector of constants times your input variables? Otherwise I would say that your current solution cannot be improved upon much. – Dennis Jaheruddin Jun 07 '13 at 09:31

1 Answers1

0

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.

sdeland
  • 1
  • 1