The GA Procedure

EvaluateLC Call

call EvaluateLC ( lc, results, sum, selected, seg<, child> ) ;

The EvaluateLC call evaluates linear constraints. The inputs to the EvaluateLC subroutine are as follows:


is a two-dimensional array representing the linear constraints.


is a numeric array to receive the magnitude of the constraint violation for each linear constraint.


is a variable to receive the sum of the constraint violations over all the constraints.


is an array identifying the selected solution.


is the segment of the solution to which the linear constraints apply.


is an optional parameter, and should be specified only when EvaluateLC is called from a user crossover operator.

The EvaluateLC routine can be called from a user crossover operator, mutation operator, or objective function to determine if a solution violates linear inequality constraints of the form $Ax \leq b$. For $n$ linear constraints in $m$ variables, the lc array should have dimension $n \times (m+1)$. For each linear constraint $i=1,\dots ,n$, lc$ [i,j] = A[i,j]$ for $j = 1,\dots ,m$, and lc$ [i,m+1] = b[i]$. The results array should be one-dimensional with size $ n$. The EvaluateLC call fills in the elements of results such that

\[  \mi {results}[i] = \left\{  \begin{array}{ll} 0, &  \mr { if } \sum \limits _{j=1}^ m A[i,j] x[j] \leq b[i] \\ \sum \limits _{j=1}^ mA[i,j] x[j] - b[i], &  \mr {otherwise} \end{array} \right.  \]

In the variable sum, the EvaluateLC call returns the value $\sum _{i=1}^ n $ results$ [i]$. Note that sum $\geq $ $0$, and sum$=0$ implies that no constraints are violated. When you call EvaluateLC from your user routine, the selected parameter of the EvaluateLC call must be the same as the first parameter passed to your user routine to properly identify the solution to be checked. The seg parameter identifies which segment of the solution should be checked. Real, integer, or Boolean encodings can be checked with this routine. If EvaluateLC is called from a user crossover operator, the child parameter must be specified to indicate which offspring is to be checked. The value child = 1 requests the first offspring, child = 2 requests the second, and so on.