Set (Command Program)

If you use the set command with other commands that depend on event states, you need to be careful not to override a command with a higher ranking command. Therefore, the command(s) to display the desired values/expressions should immediately follow the set command. For example, displaying an entire probability distribution (described later in this chapter) invalidates all previous event state settings. Assume the following definitions are in your program:

decision Capacity.{Current,New,Temp};
chance ProductionCost.{Low,Medium,High} | Capacity =
   {.2,.3},{.7,.2},{.1,.5};
value UnitCost | ProductionCost = 10.50,12.89,19.33;

In the following example, the second command (displaying the probability distribution of ProductionCost) overrides the preceding set command, so that the state of the influencing event ProductionCost is not set when UnitCost is evaluated.

set ProductionCost.High;   // invalid code
ProductionCost;   // invalid code
UnitCost;   // invalid code

An error message is displayed that says the influencing event ProductionCost is not in a known state. DPL does not know which number is represented by UnitCost since UnitCost depends on the state of ProductionCost.

In the next example, the command to display the value UnitCost immediately follows the command that sets the state of the conditioning event.

set ProductionCost.High;
UnitCost;
ProductionCost;

In this case the probability display of ProductionCost does not interfere with setting the state of the influencing event. The Log displays the number represented by the value UnitCost and the probability distribution of ProductionCost.

set ProductionCost.High;
UnitCost = 19.33;
ProductionCost
~~~Capacity.Current
___ProductionCost.Low: 0.2
___ProductionCost.Medium: 0.3
___ProductionCost.High: 0.5

~~~Capacity.New
___ProductionCost.Low: 0.7
___ProductionCost.Medium: 0.2
___ProductionCost.High: 0.1

~~~Capacity.Temp
___ProductionCost.Low: 0.1
___ProductionCost.Medium: 0.5
___ProductionCost.High: 0.4

You also need to be careful when using set commands with other features that set the states of events. For instance, a let command can override a set command in the command procedure if it occurs after the set command.

A set command executed in the Command Program is not the same as a set verb in the decision sequence section of a program. When executed in the Command Program, set commands have no effect on the results of a decision or sensitivity analysis. In fact, all event states are reset before the decision sequence of a program is analyzed.

Versions: DPL Professional, DPL Enterprise, DPL Portfolio

See Also

Working in the Command Program