sequence Annotation

The sequence annotation defines the execution and configuration order of elements in a Constraint Modeling Language (CML) model.

sequence annotation specification: Variable and Relationship

Annotationsequence
Applicable toVariable and Relationship
Value Type/Valuesinteger Example: 1, 2, 10
DescriptionIf a sequence value is not explicitly defined, the configurator implicitly determines the order based on the variable or relationship declaration order in the CML model. If a sequence value is explicitly defined, the configurator uses the sequence number to control the order in which variables or relationships are configured. Variables or Relationships with lower sequence values are assigned first.

Example 1 

In this example, the sequence annotation is not explicitly specified. The defaultValue is defined for 3 variables (controlPlacement, commissioningScope, and controlLanguage) of the Control products. The model contains a constraint.

1type GeneratorSet {
2    relation controls : Control[1..999999];
3}
4
5type Control {
6	@(defaultValue = "Left")
7	string controlPlacement = ["Left", "Right", "Top"];
8
9	@(defaultValue = "None")
10	string commissioningScope = ["None", "Remote Support", "On-site Commissioning"];
11
12	@(defaultValue = "English")
13	string controlLanguage = ["English", "Danish", "French"];
14
15	constraint(controlPlacement == "Left" && controlLanguage == "English" -> commissioningScope == "Remote Support");
16}

Example Description and Configurator Result 

The model defines 3 variables with defaultValue annotation.

1controlPlacement = "Left"
2commissioningScope = "None"
3controlLanguage = "English"

Even when sequence is not explicitly specified for the variables, the engine assigns it implicitly based on the variable declaration order in the CML type. For this example, the sequence for the variables is:

1controlPlacement: sequence = 1 (highest priority)
2commissioningScope: sequence = 2
3controlLanguage: sequence = 3 (lowest priority)

The constraint specifies that a type with controlPlacement == "Left" and controlLanguage == "English" will have a commissioningScope == "Remote Support":.

1constraint(controlPlacement == "Left" && controlLanguage == "English" -> commissioningScope == "Remote Support");

For any constraint, the engine enforces logical equivalence between the left-hand side (before ->) and the right-hand side (after ->): if the left side evaluates to true, the right side must also be true (and vice versa).

In this example, the engine resolves the true -> false constraint (to be false -> false): it modifies the controlLanguage with the highest sequence.

As a result, the Product Configurator will have next values for the variables:

1controlPlacement = "Left"
2commissioningScope = "None"
3controlLanguage = "Danish"

Example 2 

In this example, the sequence annotation is explicitly specified and the defaultValue is defined for 3 variables (controlPlacement, controlLanguage, commissioningScope) of the Control products. The model contains a constraint.

1type GeneratorSet {
2    relation controls : Control[1..999999];
3}
4
5type Control{
6
7@(defaultValue = "Left", sequence = 1)
8string controlPlacement = ["Left", "Right", "Top"];
9
10@(defaultValue = "English", sequence = 3)
11string controlLanguage = ["English", "Danish", "French"];
12
13@(defaultValue = "None", sequence = 2)
14string commissioningScope = ["None", "Remote Support", "On-site Commissioning"];
15
16constraint(controlPlacement == "Left" && controlLanguage == "English" -> commissioningScope == "Remote Support");
17}

Example Description and Configurator Result 

This example is similar to Example 1, but the sequence annotation is specified explicitly for the variables to control solver priority:

1controlPlacement: sequence = 1 (highest priority)
2controlLanguage: sequence = 3 (lowest priority)
3commissioningScope: sequence = 2

The constraint specifies that a type with controlPlacement == "Left" and controlLanguage == "English" will have a commissioningScope == "Remote Support":.

1constraint(controlPlacement == "Left" && controlLanguage == "English" -> commissioningScope == "Remote Support");
  • Following the same logical equivalence for constraints described in Example 1 and considering the default values specified in the Example 2, the left side of the constraint is true (controlPlacement = "Left" and controlLanguage = "English"), while the right side is false (commissioningScope = "None").
  • Because the commissioningScope has higher priority than the controlLanguage, the engine avoids changing the commissioningScope and instead resolves the constraint by making the left side false.
  • The controlPlacement has the highest priority sequence than the controlLanguage, so the engine modifies the controlLanguage as the most efficient way to satisfy the constraint.

Available values for the controlLanguage: ["English", "Danish", "French"]. To make the left side of the constraint false, the engine selects the first non-matching value (specified in CML domain): "Danish".

As a result, the Product Configurator will have next values for the variables.

1controlPlacement = "Left"
2controlLanguage = "Danish"
3commissioningScope = "None"

Example 3 

In this example, the sequence annotation is explicitly specified and the defaultValue is defined for 3 variables (controlPlacement, controlLanguage, and commissioningScope) of the Control products. The model contains a constraint.

1type GeneratorSet {
2    relation controls : Control[1..999999];
3}
4
5type Control{
6    
7@(defaultValue = "Left", sequence = 1)
8string controlPlacement = ["Left", "Right", "Top"];
9
10@(defaultValue = "English", sequence = 2)
11string controlLanguage = ["English", "Danish", "French"];
12
13@(defaultValue = "None", sequence = 3)
14string commissioningScope = ["None", "Remote Support", "On-site Commissioning"];
15
16constraint(controlPlacement == "Left" && controlLanguage == "English" -> commissioningScope == "Remote Support");
17}

Example Description and Configurator Result 

This example is similar to Example 2, but the lowest priority sequence is specified for the commissioningScope. This is a trigger for the engine to modify the commissioningScope first to resolve the true -> false constraint to be true -> true).

As a result, the Product Configurator will have next values for the variables:

1controlPlacement = "Left"
2controlLanguage = "English"
3commissioningScope = "Remote Support"

Example 4 

In this example, the sequence annotation is not explicitly specified for 3 relations (voltageConnections, controls, and alternators). The model contains a constraint.

1type GeneratorSet {
2    relation voltageConnections : VoltageConnection[0..999999];
3    relation controls : Control[1..999999];
4    relation alternators : Alternator[1..999999];
5
6    int alternatorsQty = controls[Control] + voltageConnections[VoltageConnection];
7    constraint(alternators[Alternator] > 0 -> alternators[Alternator] == alternatorsQty, "alternators[Alternator] = controls[Control] + voltageConnections[VoltageConnection]");
8}
9
10type Alternator;
11
12type VoltageConnection;
13
14type Control;

Example Description and Configurator Result 

Even when sequence is not explicitly specified for the relations, the engine sets it implicitly based on the relation declaration order in the CML type. For this example, the sequence for the relations is:

1relation voltageConnections: sequence = 1 (highest priority)
2relation controls: sequence = 2
3relation alternators: sequence = 3 (lowest priority)

Use mindful sequencing in CML for variables and relations to avoid backtracking issues. Define them in the order you expect the engine to modify them during constraint resolution.

Note

In this example, the CML model works without conflicts because the relations are implicitly defined with the correct sequence. The voltageConnections and controls relations are evaluated first, then the alternatorsQty is calculated from their quantities. Finally, the alternators relation is adjusted based on that result. Because the alternators is processed last, the engine avoids backtracking and errors.

Example 5 

In this example, the sequence annotation is explicitly specified for 3 relations (voltageConnections, controls, and alternators). The model contains a constraint.

1type GeneratorSet {
2	@(sequence=3)
3    relation alternators : Alternator[1..999999];
4    @(sequence=1)
5    relation voltageConnections : VoltageConnection[0..999999];
6	@(sequence=2)
7    relation controls : Control[1..999999];
8
9    int alternatorsQty = controls[Control] + voltageConnections[VoltageConnection];
10    constraint(alternators[Alternator] > 0 -> alternators[Alternator] == alternatorsQty, "alternators[Alternator] = controls[Control] + voltageConnections[VoltageConnection]");
11}
12type Alternator;
13
14type VoltageConnection;
15
16type Control;

Example Description and Configurator Result 

This example is similar to Example 4, but the sequence is explicitly specified for the relations to control the processing priority and ensure the engine evaluates and modifies them in the correct order during configuration.

sequence Configuration Settings 

Associated ExampleProduct Group StructureApplicable to”sequence” annotationUser ActionEngine ActionUI Behavior
Example 1N/AVariablenot specifiedConfigure the product containing variablesAssign the sequence for the variables based on the variable declaration order in the type. Enforce logical equivalence between left-hand side and right-hand side for the constraint by modifying the variable with the highest sequenceDisplay appropriate variable values based on sequence and constraint logic
Example 2. Example 3.N/AVariablespecifiedConfigure the product containing variablesAssign the sequence for the variables based on defined sequence annotation. Enforce logical equivalence between left-hand side and right-hand side for the constraint by modifying the variable with the highest sequenceDisplay appropriate variable values based on sequence and constraint logic
Example 4Individual productRelationshipnot specifiedConfigure the bundle product containing relationship productsAssign the sequence for the relationships based on the relation declaration order in the type. Execute the constraint (according to assigned sequence)Display adjusted relationships based on the relationship sequence and constraint logic
Example 5Individual ProductRelationshipspecifiedConfigure the bundle product containing relationship productsAssign the sequence for the relationships based on defined sequence annotation. Execute the constraint (according to specified sequence)Display adjusted relationships based on the relationship sequence and constraint logic
N/AProduct ClassificationRelationshipnot specifiedConfigure the bundle product containing relationship productsAssign the sequence for the relationships based on the relation declaration order in the type. Execute the constraint (according to assigned sequence)Display adjusted relationships based on the relationship sequence and constraint logic
N/AProduct ClassificationRelationshipspecifiedConfigure the bundle product containing relationship productsAssign the sequence for the relationships based on defined sequence annotation. Execute the constraint (according to specified sequence)Display adjusted relationships based on the relationship sequence and constraint logic