OPAL++ - Initialize Optimization with Constrains

If you have an OPAL++ case with a large amount of constrains it might be necessary to specify, that the case should be initialized only with valid individuals. If this is not specified for the first generation, OPAL++ will generate individuals in the complete range of variables, without omitting the individuals that violate the constrains.

For example: If it is specified that the first Generation should have 100 individuals, it is possible that only 10/100 individuals are valid, while 90 violate the constrains. Therefore, the first generation will run with only 10 individuals. When specifying the constrained initialization as described here, OPAL++ will only allow the generation of valid individuals.Therefore the first generation will have the desired 100 individuals.

The manual reads

XIII.13 Constrained initialization

(p. 204 in the manual)

When you start an optimization with huge number of constraints, it happens often, that the first generations only contain a couple of individuals, which do not violate constraints. Although the algorithms will slowly find their way to the feasible regions and individuals, but it is still advantageous to start the optimization with feasible individuals, and thus the cross-over and mutation operators can start immediately with feasible individuals. For this reason, OPAL++ offers a so-called constrained initialization, in which the starting generation will contain only feasible individuals.

IX. Command: ''CONSTRAINED''

(p. 98 in the manual)

  • Type of parameters: TYPE = %e
  • Input parameters:
    • logical_value - %b: value to define, whether constrained initialization is to be used
  • Description:
    • Using this command, the user can define if OPAL++ should perform a constrained initialization or a normal one.


  1. In the master.o2script add your constrains and finalize the constrains
    • Example:
      OPAL2.SETUP PROBLEM.CONSTRAINS.ADD({36-(X2-X1)*(X2-X1)-(Y2-Y1)*(Y2-Y1)},DESIGN,1.0)
      OPAL2.SETUP PROBLEM.CONSTRAINS.ADD({36-(X3-X1)*(X3-X1)-(0-Y1)*(0-Y1)},DESIGN,1.0)
      OPAL2.SETUP PROBLEM.CONSTRAINS.ADD({36-(X4-X1)*(X4-X1)-(0-Y1)*(0-Y1)},DESIGN,1.0)
  2. Finalize the definition of the problem
    • Example:
  3. If necessary change the solver settings for the number of individuals in a single generation as well as the number of maximum generations
    • Example:
  4. Define the initialization method if another method instead of random sequence is desirable (see manual page 98)
    • Example:
  5. To only allow the generation of valid individuals in the first generation, set the constrained initialization to true:
guide/opal/constrained_initialization.txt · Last modified: 2022/09/12 15:00 by kruiz@uni-magdeburg.de
Back to top
CC Attribution-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0