Performing a Subtree (DPL Code)

You can duplicate repeated sections of the sequence section with a perform link. You can define a perform link by defining labels in the sequence section of a DPL program and referring to them later in the program with the verb perform. Labels are not defined in the first part of a DPL program (the definition section). The reference tells DPL that the portion of the decision tree following the label occurs again at the point of the reference. This eliminates the need to define similar portions of an event sequence more than once.

A label is an identifier followed by a colon (:). DPL determines which identifiers represent labels from their context in the sequence section. All labels must be unique. You cannot use the same identifier for two labels in the same program.

chance Demand.{High,Average,Low} = {0.3,0.3};
value Revenues given Demand = 200, 150, 50;
chance MarketForecast.{High,Average,Low} given Demand =
   {0.7,0.2}, {0.15,0.7}, {0.1,0.2};
   to MainDecision: decide
      to gamble on Demand and receive Revenues - 120
      to quit
   to pay 10 and gamble on MarketForecast then
      perform MainDecision

A label must appear in a DPL program before a perform clause that references it. Several perform clauses can reference the same label. You cannot create a loop with a perform clause. In other words, a perform clause cannot occur in the portion of a decision tree following the label referenced within that perform clause.

Versions: DPL Professional, DPL Enterprise, DPL Portfolio

See Also

The Sequence Section

The Definition Section