# Classes of variables and other objects

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The shape of a node indicates the class of the variable or other object:

 A rectangle depicts a decision variable — a quantity that the decision maker can control directly. For example, whether or not you take an umbrella to work is your decision. If you are bidding on a contract, it is your decision how much to bid. An oval depicts a chance variable — that is an uncertain quantity whose definition contains a probability distribution. For example, whether or not it will rain tomorrow is a chance variable (unless you are a rain god). And whether or not your bid is the winning bid is a chance variable in your model, although it is a decision variable for the person or organization requesting the bid. See Expressing Uncertainty for how to define a chance variable. A hexagon depicts an objective variable — a quantity that evaluates the relative value, desirability, or utility of possible outcomes. In a decision model, you are trying to find the decision(s) that maximize (or minimize) the value of this node. Usually, a model contains only one objective. A rounded shape (with thin outline) depicts a general variable — a quantity that is not one of the above classes. It can be uncertain because it depends on one or more chance variables. Use this class initially if you’re not sure what kind of variable you want. You can change the class later when it becomes clearer. A rounded node (with thick outline) depicts a module — that is, a collection of nodes organized as a diagram. Modules can themselves contain modules, creating a nested hierarchy. A parallelogram depicts an index variable. An index is used to define a dimension of an array. For example, Year is an index for an array containing the U.S. GNP for the past 20 years. Or Nation name is an index for an array of GNPs for a collection of nations. Indexes identify the row and column headers of a table, and the axes and key of a graph (see Introducing indexes and arrays. A trapezoid depicts a constant — that is, a variable whose value is fixed. A constant is not dependent on other variables, so it has no inputs. Examples of numerical constants are the atomic weight of oxygen (16) or the number of feet in a kilometer. It is clearer to define a constant for each such value you need in a model, so you can refer to them by name in each definition that uses it, rather than retyping the number each time. A shape like an arrow tail depicts a function. You can use existing functions from libraries, and define new functions to augment the functions provided in Analytica. See User-defined Functions and Libraries. This node is a button — when you click a button (in browse mode), it executes its OnClick expression to perform some useful action. See Creating buttons. A Text node has no computed value, it is simply used to display text. Text nodes are often used, sometimes without any text at all, to create visible groupings behind other nodes. When using to visually group nodes, you need to turn on Fill color from the Node Style dialog. As of Analytica 5.0, each text node may have a bolded title and a non-bolded description. A Picture node displays an image, and can have an OnClick expression. Create a picture node by copy/pasting an image into your diagram. An hourglass shape depicts a constraint— a relationship utilized when solving constrained optimization problems in the Analytica Optimizer edition. The constraint node appears on the toolbar only when using Analytica Optimizer. Optimization is covered in the Analytica Optimizer Guide. A top-heavy trapezoid is called a gradient variable, and is used for a variable that computes a gradient, Jacobian or partial derivative. The gradient variable is exposed as an option only in the Optimizer edition, and only in Analytica 5.0 or later. To create a gradient node, first create a general variable node, then change its Class to Gradient from its Object window or from the Attribute panel. A user input node provides a place where the user of a model can enter an input value or input values. It is a type of alias, called a FormNode, of a variable in your model, and shows/sets the definition of that variable. The node contains a label and a control. The type of control depends on how the variable is defined. It may be a text box, a button that opens a table, a button that opens a list, a choice or multi-choice pulldown, a checkbox, or even (when the node is made to be tall and the embed bit is set) an entire embedded edit table (esp. in ACP). User Input nodes are created by selecting Make user input on the Object menu. A user output node displays a calculated result, or a button that opens a result window. It is a type of alias, called a FormNode, of a variable in your model. When the value is not yet computed, a appears. When the result is a scalar, the value is shown. When the result is an array, a appears that opens a result window. If the node is tall enough, in ACP the result table of graph appears directly in the node. User output nodes are created by selecting Make user output on the Object menu. (New to Analytica 6.0) A Frame node. Frame nodes are used to show an edit table, result table or result graph directly on the diagram. They are primarily used for playing models in ACP. When you click a User input node button or User output node button on the same diagram, the corresponding edit table, result table or result graph opens in the frame node instead of in a separate window; hence, a single frame node changes which table or graph is shown as you interact with the model. A Frame node is created by dragging a text node to the diagram then changing its class to Frame node.

## Module Subclasses

All modules contain other objects, including sometimes other modules. There are several different subclasses of module:

Model: Usually the top module in a module hierarchy, saved as a separate file (document with extension .ana). Any nondefault preferences (see Preferences dialog), uncertainty options (see Uncertainty Setup dialog), and graph style templates are saved with the model, but not other module types.

Module: A collection of nodes displayed in a single diagram. A standard module contains a set of other nodes, and is usually part of the module hierarchy within a model or other module type.

Linked module: A module whose contents are saved in a file separate from the model that contains it. A linked module can be shared among several models, without having to make a copy for each model.

Library: A module that contains functions and sometimes variables. Read-in libraries are listed in the Definition menu below the built-in libraries, with a hierarchical submenu listing the functions they contain, giving easy access.

Linked library: A library saved in a file separate from the model that contains it. A linked library can be shared among several models, without having to make a copy for each model.

Form: A module containing input and output nodes. You can easily create input and output nodes in a form node by drawing arrows from their original node to the form (for outputs) or from the form to the variable for inputs. See Creating Interfaces for End Users.

You can change a module from one of these subclasses to another -- for example, to convert a standard module to a separately filed module. See below for how to do that.