DPL 9 Help

Writing DPL Programs

Writing DPL Programs

A typical DPL program is divided into two sections: a definition section and a sequence section. In the definition section, you enter a collection of statements that describe the elements of the decision problem -- decisions, chance events, data -- and how they work together. In the sequence section, you describe the sequence in which decisions are made, uncertainties are resolved, and values are calculated.

If you generate a DPL language description of a DPL Model (Convert Model to Program), the influence diagram will be described in a definition section. The DPL decision tree will be described in a sequence section. If you convert a spreadsheet to a DPL program file, it will have the appropriate format to be included in the definition section.

The Definition Section

The Sequence Section

Working with Programs

Editing DPL Programs

Comments

Comments are strings of characters that are ignored by the DPL compiler. They allow you to insert explanatory notes in a DPL program to organize it or to help other people understand it. You can create comments that occupy several lines, but you cannot nest one inside another. Comments can appear anywhere a blank or tab is allowed.

There are two types of comments in DPL. The first type is bracketed by two pairs of characters, /* and */. This type of comment can occupy more than one line. The first occurrence of */ ends the comment. DPL does not allow you to place one comment of this type inside another. This type of comment may be used in the data entry fields of the Model Window as well as in programs and command statements.

The second type of comment begins with a pair of forward slash characters (//) and ends at the end of the line. By definition, this type of comment cannot occupy more than one line.

The following are valid comments in DPL.

/* Comments can occupy
several lines. */

// Keywords like decision and chance are okay in a comment

The following is not a valid comment.

/* This is a /* nested */ comment */

DPL considers the first instance of */ to be the end of the comment, and then tries to compile the end of the comment as part of the program.

Spelling and Capitalization

It is very important to pay attention to spelling in a DPL program. DPL is case sensitive, which means that Hello and hello are not considered equivalent. All DPL reserved words are lower case (decision, chance, and value are all reserved words). User-defined identifiers can be in lower or upper case (See Identifiers).

Versions: DPL Professional, DPL Enterprise, DPL Portfolio

See Also

Program Window

Program Files