Operators

From ASCEND
Jump to: navigation, search

There are a number of operators available in the ASCEND language.

Declarative operators

The following operators apply in the declarative section of a MODEL:

Declarative operators
operator usage
= equation, constraint (define an equation)
< less-than (not supported by many solvers yet -- possibly just IPOPT?)
> greater-than (not supported by many solvers yet)
>= greater-than-or-equal (not supported by many solvers yet)
<= less-than-or-equal (not supported by many solvers yet)
<> not-equal (not supported by any(?) solvers yet)
. member operator (eg to access variables belongin to a sub-model). The dot is used, as in PASCAL and C, to construct the names of nested objects. Examples: if object a has a part b, then the way to refer to b is as a.b. Tray[1].vle shows a dot following a square bracket; here Tray[1] has a part named vle.
.. range operator (see Arrays and sets). Dot-dot or double dot. Integer range shorthand. For example, my_integer_set :== [1,2,3] and my_integer_set :== [1..3] are equivalent. If .. appears in a context requiring (), such as the ALIASES/IS_A statement, then the range is expanded and ordered as we would naturally expect.
:== constant and set assignment. Both constants and sets are calculated during the instantiation process and after that can't be changed. This operator distinguishes definition of immutable values from those of mutable ones.
== logical equality.
!= logical inequality.
+ plus. Numerical addition or set union.
- minus. Numerical subtraction or set difference.
* times. Numerical multiplication or set intersection.
/ divide. Numeric division. In most cases it implies real division and not integer
division.
^ power. Numeric exponentiation. If the value of y in x^y is not integer, then x must be greater than 0.0 and dimensionless.
- negative (unary operator).
| SUCH_THAT alias.

Procedural section

The following operators can be used within METHODs:

Procedural operators
operator usage
:= value assignment (can also be part of a FIX statement)