Beginning on 4.97 AIMMS version, warning and possibly errors will reinforce the differences between the pipe sign (|) and the dollar sign ($).
A new article discusses deeply the historical reasons and the differences, but you can also have a peak of the differences below.
Dollar Sign
The $
is used to impose a condition on a part of an expression as in:
A(i) := B(i) $ C(i);
This is semantically the same as:
A(i) := if C(i) then B(i) else 0 endif;
Pipe Sign
The operator |
is used to restrict an index domain. An index domain can be specified at several places in the model:
-
At the left-hand-side of a multi-dimensional assignment:
A((i,j) | restriction(i,j)) := rhs(i,j)
-
In an iterative operator:
sum((i,j) | restriction(i,j), term(i,j) )
-
In the index domain attribute of an identifier:
Index domain: (i,j) | restriction(i,j)
-
In a
for
statement:for (i,j) | restriction(i,j) do
! some code
endfor; -
In a constructed set expression:
MySet := { i | restriction(i) }
! or
MyRelation := { (i,j) | restriction(i,j) }