9.59 OrderedVariableListΒΆ

The domain OrderedVariableList provides symbols which are restricted to a particular list and have a definite ordering. Those two features are specified by a List Symbol object that is the argument to the domain.

This is a sample ordering of three symbols.

ls:List Symbol:=['x,'a,'z]
\[\]
[x,a,z]

Type: List Symbol

Let’s build the domain

Z:=OVAR ls
\[\]
OrderedVariableList[x,a,z]

Type: Domain

How many variables does it have?

size()$Z
\[\]
3

Type: NonNegativeInteger

They are (in the imposed order)

lv:=[index(i::PI)$Z for i in 1..size()$Z]
\[\]
[x,a,z]

Type: List OrderedVariableList [x,a,z]

Check that the ordering is right

sorted?(>,lv)
\[\]
true

Type: Boolean