Aspen SCM‎ > ‎Expert System‎ > ‎2. Flow of Control‎ > ‎

2.3 AND and OR

The keywords AND and OR are used in Aspen SCM Expert System with their logical meaning. They can appear either in the Code or the Description of a rule. In the Description they act as delimiters to separate statements.

AND

Provided the previous statements have been established as true, an AND causes the interpreter to execute the next statement so as to try to maintain truth of the complete rule.

OR

The statement A OR B is established as true if A is found to be true; in this case no attempt is made to find whether B is true or not. Only if A is found not to be true is B evaluated; if it is true, A OR B is true. Hence clauses after an OR are ignored until such time as a statement has been found not to be true. The sequence in which OR clauses are tried in an attempt to establish truth is discussed in sections 2.7  and  2.8

OR Blocks

Most rules only use ORs in the Description. OR can also be used in the Code, where it behaves in a manner similar to an OR in the Description, i.e. it is executed if the preceding code has not ended TRUE. If the code below the OR resolves TRUE, this enables the THEN clause to be executed, potentially proving the predicate.

A significant difference between an OR in the Code and an OR in the Description is that all local variables (except input predicate arguments) are freed before processing continues from an OR in the Code. This limits its usefulness.

OR blocks are not executed after a BREAK from an outermost loop (see section 2.b), even if the predicate has not been proved. Thus an OR block only provides an alternative way of proving the predicate where a rule either does not loop or where the outer loop does not have a BREAK.


Back                                Next
Comments