Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Logic in AMPL | ||||||||
Line: 16 to 16 | ||||||||
Relational operators are used to compare two expressions. They are most commonly used in constraints, but not exclusively. The relational operators are:
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Line: 24 to 24 | ||||||||
Return to top | ||||||||
Changed: | ||||||||
< < | Logical Expressions | |||||||
> > | Logical Expressions | |||||||
Logical expressions are expressions that will evaluate to either true or false. Logical expressions are usually defined in terms of the relational operators: | ||||||||
Changed: | ||||||||
< < | \begin{verbatim} sum {i in INGREDIENTS} FatPercent[i] * Percentage[i] >= MinFat \end{verbatim}
\begin{verbatim} sum {i in INGREDIENTS} FibrePercent[i] * Percentage[i] <= MaxFibre; \end{verbatim} However, there are some special logical expressions in AMPL for use with sets:
| |||||||
> > | Lower[r] <= sum {i in INGREDIENTS} Contributes[r, i] * Amount[i] sum {s in SURFBOARDS} Recipe[m, s] * Production[s] <= Supply[m];However, there are some special logical expressions in AMPL for use with sets:
| |||||||
Changed: | ||||||||
< < | Logical expressions can be built up from other logical expressions, binary parameters and logical operators. | |||||||
> > | Return to top | |||||||
Changed: | ||||||||
< < | Under Construction | |||||||
> > | Binary Parameters | |||||||
Deleted: | ||||||||
< < | Binary Parameters | |||||||
In AMPL we can create binary parameters by using the {\tt binary} keyword in the parameter declaration:
\begin{verbatim} param stillSearching binary; |