Optimizing strategies with allow list functions
When a globally optimized strategy cannot be optimized because its component or components contain expressions with unsupported functions, you can add the functions to the pyWhitelistfunction data transform or change the strategy logic to contain only supported functions.
Condition
In Dev Studio, you can verify which components are optimized to decide which functions you want to define as allow list functions on the strategy canvas or on the Global Optimization tab, as shown in the following figures:
Cause
A strategy component cannot be optimized when it contains functions that are not on the list of allowed functions. The following functions are allowed:
Functions allowed for optimization
Function | Ruleset | Library | Parameters |
divide | Pega-RULES | Math | (BigDecimal::dividend, BigDecimal::divisor) |
today | Pega-RULES | DateTime | N/A |
normal | Pega-DecisionEngine | Random | N/A |
normal | Pega-DecisionEngine | Random | (double::mean, double::sd) |
random | Pega-DecisionEngine | Random | N/A |
random | Pega-DecisionEngine | Random | (double::min, double::max) |
and | N/A | N/A | (boolean::param...) |
or | N/A | N/A | (boolean::param...) |
getDate | Pega-RULES | DateTime | (String::strStamp) |
DateTimeDifference | Pega-RULES | DateTime | (String::beginTime, String::endTime, String::strPrecision) |
if | N/A | N/A | (boolean::condition, then, otherwise) |
Solution
Investigate the strategy that you want to optimize and consider changing the strategy's logic. You might need to use different strategy components or reconfigure the existing ones to remove references to the functions that cannot be optimized. Alternatively, it might be possible to add these functions to the pyWhitelistFunction data transform and enable optimization for the component that uses the functions.
- In the navigation pane of Dev Studio, click Records.
- Expand the Data Model category, and then click Data Set.
- In the list of data transform rules, click pyWhitelistfunction.
- On the Definition tab, place the cursor in one of the first-level rows, and then click the Add a row button.
- Define the new function:
- From the list in the Action column, select Update Page.
- In the Target column, enter: pyWhiteListFunction
- To propagate values from another page, from the list in the Relation column, select with values from and then enter the page name in the Source column.
- Add and fill in the second-level rows with the following
properties:
- .pyFunctionName
- .pyMethodName
- .pyLibraryName
- .pyRuleSetName
- .pyReturnType
- .pyParameters
The following figure shows a sample configuration of a new allow list function:
- Confirm the changes by clicking Save.
- Rerun the globally optimized strategy.
- On the Test tab of the optimized strategy, do a side-by-side comparison to see differences between non-optimized and optimized results.
Previous topic Creating a globally optimized strategy Next topic Strategy canvas accelerators and keyboard shortcuts