Optimization problems require one or more metrics to be defined. The metrics are used as a basis for optimization, or for helping define the constraints of the problem. In either case, defining an optimization metric in LityxIQ follows the same process.

The Defined Metrics area of the Metrics & Objective tab within the Scenario Settings dialog looks like the following:

For metrics that you have defined, the icons can be used to Edit and Delete the metrics, respectively. To create a new metric, click the Add Metric button. Whether creating a new metric from scratch, or editing an existing metric, the dialog looks like the following. This document described the options available.

# Metric Formula Tab

**Label** - Enter the text label to be used for this metric in reporting or in the interface.

**Simple vs Complex Metric** - Select whether this is a simple or complex metric. Each possibility leads to a different method for computing the metric and is defined below.

- A simple metric is one that is computed directly from summarizing the raw dataset. Typically it is defined as a sum of a particular variable (Data Element) in the dataset.
- A complex metric is one that is computed based on combining other Simple or Complex metrics.

__Simple Metric Options__

For a more detailed overview of Simple Metrics, see: https://support.lityxiq.com/181244-Simple-Optimization-Metric.

**Summary Function** - Select either SUM, MIN, MAX, or AVG. This determines how the dataset is aggregated to compute the metric. In general, only the SUM function leads to the metric being available for optimizing or for constraints. Any summary function selected will allow the metric to be available for reporting.

**Data Element and Multiply By ... **- All Data Elements selected on the Dataset & Settings tab will be available in the Data Element dropdown. The options "none" is available also. In combination with the Multiply By option, these settings define how the summary metric is computed.

- If Multiple By is checked, then the metric is computed by summarizing over the dataset by multiplying the result of the optimization by the data element.
- If Multiple By is not checked, then the metric is computed by summarizing over the dataset by simply applying the Summary Function to the selected data element.

__Complex Metric Options__

For an overview of Complex Metrics, see: https://support.lityxiq.com/910529-Complex-Optimization-Metric. An overview of the options provided is below.

**Numerator** - Select the existing metric that will serve as the numerator for this complex metric. This is required.

**Denominator** - Optionally, select the existing metric that will serve as the numerator for this complex metric.

**Right Hand Side** - Optionally, set the right hand side of the complex metric definition. Options are:

- No RHS - do not have a right hand side to the metric
- Enter a Constant - enter a constant value manually for the RHS. In this case, you will also enter a sign that connects the right hand side and the constant value.
- Use a Summary Metric - use another metric on the RHS. In this case, you will also enter a sign that connects the right hand side and choose the summary metric.

__Fixed Cost Metric Options__

For an overview of Fixed Cost Metrics, see: https://support.lityxiq.com/414618-Fixed-Cost-Metric. An overview of the options provided is below.

**Attribute** - Select the attribute in your optimization problem that will serve as the basis for the fixed cost metric. Each level of this attribute that is involved in the final optimization solution will have a fixed cost associated with it.

**Data Element** - Select the data element that holds the fixed cost that would be applied to each attribute level. This allows the fixed cost to be different for any particular attribute level. If the fixed cost is the same value for any chosen attribute level, select "Enter Value Manually", which will make the Fixed Cost Value option available (see below).

**Fixed Cost Value** - In the case of selecting "Enter Value Manually" as the Data Element, enter the fixed cost that applies to any attribute level that is part of the final optimization solution.

## Formula

For any type of metric, you will also be shown a **Formula. ** This area shows the formula that results from the combination of the options you have chosen. If the formula results in an invalid metric, you will see "invalid" displayed in the Formula box.

# Display Options Tab

The Display Options tab relates only to how computed values of the metric are shown when analyzing outputs. These settings have no effect at all on how the metric itself is computed.

**Rounding** - set the number of decimal places for rounding off displayed values of the metric.

**Prefix** - set the prefix string to be shown in front of displayed values of the metric.

**Suffix** - set the suffix string to be shown on the right side of displayed values of the metric.

When finished, click Save to save all options from both tabs and close the dialog. Click Cancel to close and not save your changes.