Given a set of cost coefficients, obtained from a "representative" training data set and some desired set, we have
previously shown that the optimal Boolean filter, based on a defined error criterion, is obtained by simple compare/assign
operations. If, on the other hand, the desired solution is a stack filter, three steps must be added to the above procedure.
Following the compare/assign step above, we check if the resulting solution is of the desired type. If not, we compute
the maximal positive Boolean function contained in the resulting Boolean function. Finally, we check if adding other
minterms to the positive Boolean function obtained in the previous step will improve the criterion value.
The first step requires a very low computational effort. For the following three steps, matrix based procedures using
the stacking matrix, are derived. First, we derive a fast procedure for checking the positivity of a Boolean function.
This procedure can be written in a single line using Matlab® language. The following step consists of finding the
maximal positive Boolean function embedded in a given Boolean function. Again, a fast procedure is derived for this
task, which can also be written in one line using Matlab® language. The final step checks for improvement, in the cost
criterion, when adding other minterms to the positive Boolean function, resulting from the previous step. We will use
again the stacking matrix to accomplish this task, resulting in a three-line Matlab®code. Some examples are provided
to illustrate each step in the above procedure.