02 - Constraint Solving With Advanced Variant Configuration
02 - Constraint Solving With Advanced Variant Configuration
PUBLIC
Agenda
Constraint
• Describes a condition that some variables must satisfy
Constraint Solving
• process of finding a solution to a set of constraints
• solution is the set of values for all variables that satisfies all constraints
• Unassign Defaults
leading to
inconsistency!
Constraints
A 2 – 8 A = B
B < C
B 4 – 12
A ≠ D
C 4 – 8 Assignment
D = 5
D 4 – 8 C = 5
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 8
Event on Constraints
A = B → Domain Changed
A ≠ D → Assignment Changed
• Easy constraints are executed early, crazy constraints are executed latest
A = B → easy
B < C → easy
A ≠ D → easy
A 2 – 8
A = B Domain of A & B
are different
B 4 – 12 B < C
C 4 – 8 A ≠ D
D 4 – 8
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 12
Restrict Solution - Restrict Step 1.1
A 2 – 8 A = B
4-8
B 4 – 12
Create Intersection
between A and B
A 44 – 88
A = B
B 4 – 8 B < C
Event:
Max of B changed
from 12
to 8
C 4 – 8 A ≠ D
D 4 – 8
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 14
Restrict Solution - Restrict Step 1.2
B 4 – 8 4 – 7
B < C
C 4 – 8 5 – 8
Compare Min & Max Values
Bmax < Cmax
Cmin > Bmin
A 4 – 8
A = B
B 4 – 7 B < C
Event:
Domain of B changed from
4-8
to 4-7
C 5 – 8 A ≠ D
D 4 – 8
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 16
Restrict Solution - Restrict Step 1.3
A 4 – 8 A = B
4-7
B 4 – 7
Create Intersection
between A and B
A 4 – 7
A = B
B 4 – 7 B < C
C 5 – 8 A ≠ D
D 4 – 8
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 18
Post 1st Assignment & Restrict Solution
Constraints Event:
A 4 – 7 A = B
Assignment of D changed
from unassigned
to 5
B < C
B 4 – 7
A ≠ D
C 5 – 8 Assignment
D = 5
D 5
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 20
Restrict Solution - Restrict Step 2.1
A 4 – 7 A ≠ D 4/6–7
D 5 5
Exclude assigned value
from unassigned domain
Constraints Event:
A 4 /6– 7 A = B
Domain of A changed
from 4-7
to 4/6-7
B < C
B 4 – 7
A ≠ D
C 5 – 8 Assignment
D = 5
D 5
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 22
Restrict Solution - Result
Constraints
A 4 /6– 7 A = B
B < C
B 4 /6– 7
A ≠ D
C 5 – 8 Assignment
D = 5
D 5
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 23
Post 2nd Assignment & Restrict Solution
Constraints
Event B < C:
A 4 / 6 -7 A = B Min/Max of C changed
from 5/8
to 5
B < C
B 4 / 6 -7 Result: B = 4
A ≠ D
C 5 Assignment
Event A = B:
D = 5 Domain of B changed
from 4/6-7
D 5 C = 5 to 4
Result: A = 4
Constraints
A 4 A = B
B < C
B 4
A ≠ D
C 5 Assignment
D = 5
D 5 C = 5
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 26
Why you should use constraints…
Constraints
X =1 If Y = 2
X is assigned to 2!
2 =1 If Y = 2
Valid solution enforces Y <> 2
• Easy constraints are executed first, complex constraints are executed later
Stay Consistent
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 34
Thank you.
Contact information:
Andreas Koelbl
Product Owner Advanced Variant Configuration Engine
[email protected]