6.5 離散変数クラスDiscreteVariable
離散変数クラスDiscreteVariable
は,wcspでのみ利用可能な構成要素です.必ず引数に定義域dom
を持つ必要があります.引数dom
が集合Set
,順序集合OrderedSet
,数列集合Sequence
を指すことにより,その離散変数が取り得る値の範囲を定めます.
次の例では,1から3までの値を取る離散変数x
を定義しています.
Set S = "1 2 3"; DiscreteVariable x(dom = S);
離散変数DiscreteVariable
の定義域は,必ずしも整数である必要はありません.次の例では,open
あるいはclosed
のいずれかを取る離散変数y
を定義しています.
Set S = "open closed"; DiscreteVariable y(dom = S);
離散変数DiscreteVariable
は添字を取る事もできます.次の例ではopen又はclosedを取る離散変数y[1], y[2], y[3]を定義しています.
Set S = "open closed"; Set T = "1 2 3"; Element i(set = T); DiscreteVariable y(dom = S, index = i);
上に戻る