Option List

Option List is the element for defining agent attributes that have limited choice of alternative options, e.g.:

For example, you can define the sex agent attribute as a Sex option list with the following elements: Male, Female.

 To create an option list

  1. In the Projects view, right-click (Mac OS: Ctrl+click) the model you are currently working with and choose New > Option List… from the context menu.

  1. The New Option List dialog box opens. In the Name box (in our case, it is Sex), specify the name of the new option list. 
  2. In the Specify elements table, type the names of the options (Male and Female).

  1. Click Finish to complete the process.

In the project tree, option lists appear on the upper level, grouped in the  Option Lists branch.

Having defined the option list, you can choose this list as the agent parameter's type.

Now you can assign values (Male or Female) to the sex agent's parameter.

To set a default value, specify an option list's value in the parameter's Default value field, e.g: Male.

To change the value at the model runtime, type sex = Female;

If you need to assign values for the whole agent population, you may do it e.g. in the top level agent's Startup code.

Select one random option from an option list

For example, you have the option list named Gender. To randomly select one option from this option list, use one of the following functions: