Branches in the Sequence Section (DPL Code)

If a decision or chance node is symmetric, the DPL language provides a way to use schematic notation, as in a decision tree. The event name appears by itself, and the individual states are not listed. For example,

gamble on Demand then ...

If a decision or chance node is asymmetric, then each state must be listed:

gamble
   on Demand.High then ...
   on Demand.Medium then ...
   on Demand.Low then ...

In this case, DPL will generate an error message if you do not describe every alternative associated with a decision or chance event. If the name of a decision or chance event appears with the name of only one state, the names are separated by a period. If the name appears with the names of two or more states, the name is followed by a period and a list of the state names. The state names are enclosed in braces and separated by commas.

gamble
   on Demand.High then ...
   on Demand.{Medium, Low} then ...

The keywords representing a decision's alternatives or a chance event's states must start in the same column. Also, they cannot start in the same column as the keywords representing states of another event if you specify states for that event both earlier and later in the sequence section. DPL uses the columns in which these keywords occur to distinguish the states of one event from those of another. If there is any ambiguity about which event is associated with an event state, DPL associates the state with the event that appeared most recently in the program. The following sequence section is incorrect:

sequence:   // incorrect code
   decide
      to Get_Info.Yes and pay Info_Cost then
         gamble on Market_Forecast then
   decide
      to Release_Product.Yes and          // INDENT
         gamble on Demand and get Profit  // THESE
      to Release_Product.No               // LINES
      to Get_Info.No then
   decide
      to Release_Product.Yes and
         gamble on Demand and get Profit
      to Release_Product.No 

If a program contains tab characters, DPL determines the column in which a keyword starts based on the current tab size. If you write a DPL program with another editor that sets tab stops at other locations, keywords that appear to start in the same column when viewed in that editor may not do so in DPL. To avoid this problem, use the DPL editor to check the columns in which keywords start and change the tab size if necessary. Another solution is to indent keywords with spaces instead of tabs.

You can place the keywords representing a decision's alternatives or a chance event's outcomes in any column, as long there is no ambiguity about which event each alternative belongs to. The keywords do not all have to be the first words in a line. The following program is a variation of the first example in which the keyword for the first alternative of a decision appears on the same line as the keyword decide. DPL can interpret this program correctly because the decision's alternatives are described by keywords that start in the same column.

sequence:
decide to Get_Info.Yes and pay Info_Cost then ...
       to Get_Info.No then ...

Normally, you indent further the keywords for alternatives or outcomes that occur later in the sequence of events more than those for alternatives or outcomes that occur earlier. However, DPL does not require this. For example, the DPL compiler interprets the following program correctly, even though the keywords for the outcomes of the decision Release_Product are indented less than those of the decision Get_Info. The fact that keywords for the two sets of outcomes start in different columns is sufficient for the compiler to distinguish them.

sequence:
   decide
      to Get_Info.Yes and pay Info_Cost then ...
decide
   to Release_Product.Yes and ...
   to Release_Product.No
      to Get_Info.No then
decide
   to Release_Product.Yes and ...
   to Release_Product.No 

Versions: DPL Professional, DPL Enterprise, DPL Portfolio

See Also

The Sequence Section

The Definition Section