Setting the State of an Event (Command Program)

When you use the set command in the Command Program, you are setting the state of events temporarily for evaluating a particular scenario.

set BrandX.Domestic;
set BrandX.Intl;

The set command temporarily sets the state of the event BrandX until you specify otherwise. The Log echoes the corresponding number represented by SalesForecast.

set BrandX.Domestic;
SalesForecast; = 42088
set BrandX.Intl;
SalesForecast; = 59998

In the preceding examples, SalesForecast was directly conditioned by BrandX. If it had been indirectly conditioned by other events, the states of those events would have to have been established by additional set commands. Note that the set command is the only way to establish the state of an indirect conditioning event. You cannot establish states of indirect conditioning events with the given ( | ) command described in the previous section. For example, consider the following code:

chance Revenues.{Low,Med,High} = {.25,.5} = 10,20,30 ;
chance Costs.{Low,Med,High} = {.25,.5} = 5,10,15;
value Profit = Revenues - Cost ;

Because Profit indirectly depends on Revenues and Costs, it cannot be evaluated unless the states of Revenues and Costs are known.

set Revenues.High;
set Costs.High;

The set command is used only to identify a state of the world for displaying values. It does not affect the compiled program and does not affect model runs. Be careful not to confuse it with the let command, which is used to change program values and does affect model runs (See Changing Values).

The set command is useful for examining the outcome for a specific path of the decision tree for your problem. To examine values and expressions at a particular node or path endpoint, you need to define the state of the world leading up to that point. You can use the set command in the Command Program to temporarily set the state of one or more events in order to display these values on the Log.

Consider an example represented by the following abbreviated DPL program.

decision d1.{5};
decision d2.{3};
chance c1.{3} = ...
chance c2.{4} = ...
chance c3.{3} = ...
value v1 | d1,c1 = ...
value Total = @npv(...);
decide about d1 then
gamble on c1 then
decide about d2 then
gamble on c2 then
gamble on c3 then
get Total

The tree represented by this sequence section contains 540 paths. At the end of each path, the value model culminating in the value Total is evaluated to produce the path outcome. The value model could involve many interrelated variables and may produce a different outcome of Total for each path through the tree.

To examine the model outcome for a particular path, the states of all events must be set as they would be if the sequence were evaluated using one of the Run options from the Main window. (DPL automatically sets the states all of events when it evaluates your program.) The following command procedure will display the model outcome for one path through the tree:

set d1.s1,

The result will be printed to the Session Log.

Total = 2389220

By editing and re-executing the command procedure, you can examine the model outcome for any path through the tree.

Although the policy data gathered during the program evaluation can also contain model outcomes for each path, it may not be feasible to gather complete policy data for larger trees. In this case, the Command Program can still be used to examine selected paths.

Instead of simply displaying Total, as was done in this example, the command procedure could contain a series of display function (described later in this chapter) specifications to display as much of the value model as desired in a customized format. This technique is especially useful for debugging your value model -- you can examine its performance at various parts of the tree before conducting a full analysis.

Versions: DPL Professional, DPL Enterprise, DPL Portfolio

See Also

Working in the Command Program