Task 6: Applying a decision logic to many values
Complex decision-making problems often involve an arbitrary number of components, each requiring an individual decision. This document explains how to handle such scenarios efficiently by using multi-valued nodes and quantifiers.
Consider a camera recommendation system where customers can purchase various lens types:
- Customer A wants a standard lens and a telephoto lens.
- Customer B wants a standard lens, a super-telephoto lens, and a wide-angle lens.
- Customer C wants a super wide-angle lens.
Each lens type requires selecting a specific lens model based on the lens type and the camera's sensor format.
A basic implementation creates one input data node and one decision node per lens type, replicating the decision logic across all nodes. This implementation would lead to the following scalability issues:
- Five lens types would require ten nodes total, making the diagram too large.
- The same decision logic would be copied multiple times.
- Any change to the decision logic would require updating all copies, which is error-prone.
- Adding Len types would require even more nodes and duplication.
An elegant and scalable solution for problems with an arbitrary number of components is possible when two conditions are met:
- Component independence
- Each component decision must be independent. Other components are ignored when deciding for a
particular component. If you take the camera model example, each wanted lens type defines a
subproblem that consists of:
- The required lens type.
- The lens model chosen for the lens type.
- The decision logic that is defined according to the lens model that is chosen.
In addition, each subproblem takes the sensor format of the camera into consideration. For example, if you introduce three lens types, three subproblems of the same structure are generated. Each subproblem contains a node that specifies a lens type, a node that specifies a sensor format, and a node for choosing the lens model:
- Subproblem 1 consists in choosing
lensModel1forlensRequirement1andsensor format. - Subproblem 2 consists in choosing
lensModel2forlensRequirement2andsensor format. - Subproblem 3 consists in choosing
lensModel3forlensRequirement3andsensor format.
- Uniform decision logic
- All subproblems must apply the same decision logic to different nodes. For example, the three
subproblems can all use the same rule that chooses a lens model with a focal length of
14:42and an aperture of3.5:5.6:- If
lensRequirement1is a standard lens andsensor formatis Micro Four Thirds thenlensModel1has a focal length of14:42and an aperture of3.5:5.6. - If
lensRequirement2is a standard lens andsensor formatis Micro Four Thirds thenlensModel2has a focal length of14:42and an aperture of3.5:5.6. - If
lensRequirement3is a standard lens andsensor formatis Micro Four Thirds thenlensModel3has a focal length of14:42and an aperture of3.5:5.6.
Each rule checks whether the lens type is standard lens and the sensor format is Micro Four Thirds. When both conditions are met, the rule assigns a lens model with focal length
14:42and aperture3.5:5.6to the corresponding subproblem. Since all three rules share identical conditions and actions, differing only in which nodes they reference, they can be consolidated into a single universal rule:For each subproblem x: if the lens requirement of x is standard lens and the sensor format is Micro Four Thirds then the lens model of x has a focal length of 14:42 and an aperture of 3.5:5.6.
- If
Decision Designer provides a compact way to represent multiple subproblem versions. Instead of creating separate input data nodes for each lens type, you can use a single multi-valued input data node called lens requirements. This node can hold multiple lens types simultaneously:
- Customer A requests a standard lens and a telephoto lens: the node contains two values.
- Customer B requests a standard lens, a super-telephoto lens, and a wide-angle lens: the node contains three values.
Decision Designer supports two node cardinalities:
| Type | Description |
|---|---|
| Single-valued | Contains exactly one value |
| Multi-valued | Contains zero, one, or multiple values |
The node or attribute type determines the type of values that it contains.
You could replace the multiple single-valued nodes that are used so far with:
- One multi-valued input data node named
lens requirementsthat contains all requested lens types. - One multi-valued decision node named
lensesthat collects all recommended lens models.
Rather than setting the value of this decision variable, you can use the add
<value> to <decision> ; action to append values to multi-valued nodes. In this
example, each added value is a lens model with focal length and aperture specifications. Both
specifications can use the range composite type, which contains a minimum and a
maximum value. The decision is made by using the following action:
add a new lens model where
the focal length is a new range where
the minimum is 14 ,
the maximum is 42 ,
the aperture is a new range where
the minimum is 3.5 ,
the maximum is 5.6
to decision;
Decision Designer also provides a simple way to execute universal rules: quantifiers. Quantifiers apply logic to each value independently:
for each lens type called 'x', in 'lens requirements'
<some logic>
This construct iterates through each lens type and applies the logic to it individually, ignoring all other lens types. The logic within the quantified statement processes only one subproblem at a time, making sure that each subproblem is evaluated independently.
The universal rule that is given in the previous section can be expressed by using a quantifier:
for each lens type called 'x', in 'lens requirements'
if x is standard lens and 'sensor format' is Micro Four Thirds
then add a new lens model where
the focal length is a new range where
the minimum is 14 ,
the maximum is 42 ,
the aperture is a new range where
the minimum is 3.5 ,
the maximum is 5.6
to decision;
Exercise 1: Single-valued implementation
You create a traditional implementation by using single-valued nodes:
- Go to the data model and define the following data types:
- An enumeration type named
lens typewith the following values:standard lens,super-telephoto lens,super wide-angle lens,telephoto lens, andwide-angle lens. - A composite type named
rangewith two numeric attributesminimumandmaximum. - A composite type named
lens modelwith the following attributes:nameof typestring;focal lengthof typerange, andapertureof typerange.
- An enumeration type named
- Create a decision model and add the following single-valued nodes:
- Three input data nodes of type
lens type. - Three decision nodes of output type
lens model.
Each decision node must depend on one input node and the sensor format node, as shown in the following screenshot:

- Three input data nodes of type
- For each decision node, create a decision table:
- In the decision table creating wizard, select the appropriate lens requirement and
sensor formatas criteria. - Right-click the top cell of the lens column and click Define column.
Then, enter the following
rule:
set decision to a new lens model where the name is <name> , the focal length is a new range where the minimum is <a number> , the maximum is <a number> , the aperture is a new range where the minimum is <a number> , the maximum is <a number> - Update the lens subcolumn labels to
name,min focal length,max focal length,min aperture, andmax aperture.
- In the decision table creating wizard, select the appropriate lens requirement and
14:42 and aperture
3.5-5.6 as a standard lens for a Micro Four Thirds format:
Exercise 2: Multi-valued implementation
You refactor the decision model to replace single-valued nodes by using multi-valued nodes and quantifiers:
- Create new nodes:
- Create an input data node named lens requirements of type
lens type. Then, click Output is a list to make it multi-valued. - Create a decision node named lenses of type
lens model. Then, click Output is a list to make it multi-valued.
Make sure that the lenses decision node depends on the lens requirements and sensor nodes, as shown in the following screenshot:
- Create an input data node named lens requirements of type
- Create a decision model that recommends lens models:
- In the decision table creating wizard, select
lens requirementandsensor formatas criteria. - Click Edit preconditions in the decision table editor and enter the
following
rule:
for each lens type called 'lens type' , in 'lens requirements' - Right-click the top cell of the lens requirement column and click Define
column. Then, enter the following
rule:
Then, update the column label to'lens type' is <a lens type>lens requirements. - Right-click the top cell of the lens column and click Define column.
Then, enter the following rule:
Then, update the subcolumn labels toadd a new lens model where the name is <name> , the focal length is a new range where the minimum is <a number> , the maximum is <a number> , the aperture is a new range where the minimum is <a number> , the maximum is <a number> to decisionname,min focal length,max focal length,min aperture, andmax aperture. - Complete the decision table as done in exercise 1:

- In the decision table creating wizard, select
Lessons learned
- Each decision is made for a single component.
- All decisions follow the same logic.
When these conditions are met, the decision logic can be expressed as universal rules applied to multi-valued node values. Decision Designer implements these rules by using quantifiers.
Limitations
This approach works when decision logic fits within a single decision table. More complex scenarios requiring multiple interconnected decision nodes need advanced techniques that are covered in the next task.