Multiple Attributes, Objective Functions, and Constraints (DPL Code)

If a decision problem has several attributes, you must specify the number of attributes and an objective function for combining the attributes into a single value or accept DPL's default function. This tells DPL how to determine the optimal Policy Tree. An objective function is a special type of expression that includes the attributes as operands. DPL provides a default objective function if you do not specify one. The default objective function is the sum of the attributes.

You specify the number of attributes and an objective function (if any) immediately following the keyword sequence, at the beginning of the sequence section of a program.

sequence (attributes = 2,
          objective = $1*Cost1 + $2*Cost2):

The constant expression that represents the number of attributes must produce a number between 1 and 1024, after truncation to an integer. If the number is not an integer, DPL will truncate it. If you do not specify the number of attributes, DPL assumes there is only one.

DPL provides predefined identifiers for the attributes, which you can use in the expression for the objective function. In this expression, $1 represents the first attribute, $2 represents the second attribute, and so on. (Note: In the Model Window, attributes are assigned names. In DPL code, only $1, $2, etc. can be used.) If you do not provide an expression for the objective function, DPL uses a default function equal to the sum of the attributes. If you provide an expression, it need not contain an identifier for each attribute, and any attribute identifier can appear more than once. When the identifier for an attribute is missing from the expression, that attribute does not affect the optimal Policy Tree.

The predefined identifier $0 may be used to refer to the joint probability of the path for which the function is being evaluated.

When you specify more than one attribute for a decision problem, you must provide an expression for each attribute whenever you associate a gain or loss with an event state. The expressions follow the keywords get, receive, pay, and lose. The expressions are separated by commas.

The following is an example of a DPL program that specifies two attributes:

value P = 0.02;
value MeltCost = 1.0e6;
decision Mode.{Normal,Emergency};
value OperatingCost | Mode = 20,50;
chance SystemFailure = {0.01};
chance CoreMelt given SystemFailure,Mode =
   {0.1}, {P}, {0.01}, {P};
chance Warning.{Clear,Ambiguous,None} given SystemFailure =

sequence (attributes = 2, objective = $1 * MeltCost + $2):
   gamble on Warning then
      decide on Mode and
         pay prob(CoreMelt.y),OperatingCost

DPL compiles the expression for the objective function before it processes the decision tree. This means that the expression cannot depend on the states of any events. If the expression contains values, they cannot depend on the states of events. Also the expression cannot contain the state function, which returns a number equal to the state of an event.

When there is only one attribute, DPL's default objective function is equal to that attribute. (The default objective function is the sum of the attributes, which is equal to the first attribute when there is only one.) However, you can specify an expression for the objective function even where there is only one attribute. This allows you to multiply all the gains and losses by a scale factor before DPL uses them in an analysis. It also lets you use any expression to transform the sum of the gains and losses before applying a utility function (if any) and determining the optimal policy.

The words attributes = and objective = are optional.

sequence (2, $1 * Cost1 + $2 * Cost2):

You can also specify a constraint function.

sequence (attributes = 2, objective =
         $1 * Cost1 + $2 * Cost2,
      constraint = $1 * Cost1 > 20000?
         halt(100000):$1 * Cost1 + $2 * Cost2):

Because the constraint is only checked before evaluating a node in the tree, and not at the endpoints, you may also wish to put the constraint expression in the objective function and copy it in the constraint function with an asterisk:

sequence (attributes = 2,
   objective = $1 * Cost1 > 20000?
      halt(100000): $1 * Cost1 + $2 * Cost2,
      constraint = *)

Versions: DPL Professional, DPL Enterprise, DPL Portfolio

See Also

The Sequence Section

Halt function