# Clarity: How to calculate Portfolio Score and Scenario by genetic algorithm (GA)

**Document ID :**KB000054470

**Last Modified Date :**14/02/2018

**Description:**

This document describes the mathematical formulas used to determine the fitness score of the scenario candidates within Clarity Portfolio Management.

Note: This information is only applicable to Clarity 12.x and Clarity 13.0 to 13.1. The Portfolio functionality has changed with Clarity 13.2 and beyond.

**Solution:**

**Genetic Algorithm**

The scenario is generated by a genetic algorithm (GA) that uses data entered by the user in the form of budget, constraint and optimization parameters. Weighting of optimization parameters allows the user to specify how important each one is. The only piece of data that is required for the GA to compute a scenario is the investment amount to

use. If a budgeted cost is not specified on the scenario properties page it will use the one specified on the portfolio's property page. All of the investments in the current portfolio that the user has rights to view and have a budgeted cost will be considered by the GA, unless they have been explicitly excluded on the scenario constraints page. Upon successful regeneration any existing investment data will be deleted and the new saved. The scenario's budgeted cost and benefit are updated to match the total of the generated scenario.

**Scoring**

The GA uses a fitness algorithm to compute a score for each candidate scenario based on the optimization parameters. If no optimization parameters are specified the GA finds the optimal set of investments whose total cost is closest to the investment amount. When scoring candidate scenarios and there is more than one optimization parameter it is important to normalize the scores so that all optimization parameters have an equal footing. For instance, you can't compare an attribute with a range between 0 and 100 with an unbounded attribute that may have a value of 1,000,000. The higher value will get more weight. Therefore the scores for each parameter will be normalized to be a decimal value

between 0.0 and 1.0.

Scoring for scalar attributes, both bounded and unbounded, is done by finding the max and min values for each parameter among all of the investments in the portfolio. Since the range may not always start at 0 the value should be adjusted to accommodate this. The formula is (value - min) / (max - min). Say the range is 10 to 110, then a value of 20

should get a score of (20 - 10) / (110 - 10) = 10/100 = 0.1. When selecting for higher values the value is used without change. When selecting for lower values the inverse is used (max - value) / (max - min). Using the example above the inverse should return a value of (110 - 20) / (110 - 10) = 90/100 = 0.9.

Scoring for enumerated attributes is determined by the lookup value weighting. The score for an investment is determined by how well its lookup value matches what the user is looking for. For example, say a lookup contains codes A, B and C, and the lookup value weighting for each is A=1.0, B=2.0, and C=0.0. Like scalar scoring it gets normalized to a value between 0 and 1 as noted above except that the normalization happens on the lookup value weighting. For example, if an investment's lookup code is B then the score is 1.0, if A it's 0.5 and if it's C the score is 0.0. The total score of the candidate scenario is the total of all the attributes' scores multiplied by their weights. For example, say there are three parameters with scores .65, .32, .87 and weights 1.0, 2.0, 1.5 respectively. Then the total score is (.65* 1.0) + (.32* 2.0) + (.87 *1.5) = 2.595.

When there is only one optimization parameter and it is optimizing for higher values no normalization or weighting is applied. For sum-based aggregation attributes this allows the user to see more clearly how that attribute applies to the efficient frontier. For example, when optimizing by Budgeted Benefit the y-axis essentially shows total Budgeted Benefit for each candidate scenario.

Finally the candidate scenario's score is adjusted to the investment level (scenario planned cost). For this a normal distribution curve is used. If the cost of the scenario is far from the targeted cost its score will be adjusted to a very low score. If the cost is very close to the targeted investment level it will not be changed much at all. For example, say there are two scenarios with the same score of 2.595. If the target investment level is $10M and the scenario costs are $10.1M and $8M, the scores will be adjusted to 0.996 * 2.595 = 2.583 and 0.169 * 2.595 = 0.439 respectively.

**Example: Scenario Efficient Frontier**

Based on the Roles, Constraints and Optimizations configured for the scenario, the Efficient Frontier provides the Portfolio Manager with a candidate list of different sets of investments. The Candidate Scenarios can be reviewed and compared for determining the best set.

**Keywords**: CLARITYKB, scenario, PPM, PMA, PMO, score, genetic algorithm, GA, scorecard.