100% found this document useful (1 vote)
210 views

02 - Constraint Solving With Advanced Variant Configuration

02_Constraint Solving With Advanced Variant Configuration

Uploaded by

Shailesh Mahajan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
210 views

02 - Constraint Solving With Advanced Variant Configuration

02_Constraint Solving With Advanced Variant Configuration

Uploaded by

Shailesh Mahajan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Constraint Solving with

Advanced Variant Configuration


Andreas Koelbl, SAP
October, 2018

PUBLIC
Agenda

Constraint Solving with Advanced Variant Configuration


• Introduction into AVC Constraint Solving
• Constraint Solving Example
• Implicit Constraints - Examples
• Demo: Solving Sudoku
• Summary

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 2


SAP
Introduction into AVC Constraint Solving
Configuration Engine

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 4


Future Direction
Constraint Solving

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

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 5


Sequence of dependency processing

Restrict Post Restrict Change


Solution Assignment Solution Facets

• Constraints • Interactive Assignments • Constraints • Precondition on Cstic


• Precondition on Value • Static Defaults • Precondition on Value • Selection Condition on cstic
• Procedures

• Unassign Defaults
leading to
inconsistency!

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 6


SA
Constraint Solving Example
Example

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

• Each constraint is triggered by an event

• Event depends on operator / syntax element

A = B → Domain Changed

B < C → Min / Max Value of Domain Changed

A ≠ D → Assignment Changed

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 9


Complexity of Constraints

• Each constraints is assigned to a a complexity cluster (from easy to crazy)

• Easy constraints are executed early, crazy constraints are executed latest

A = B → easy

B < C → easy

A ≠ D → easy

Read Table → crazy


© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 10
Restrict Solution - Example

Restrict Post Restrict Change


Solution Assignment Solution Facets
Restrict Solution - Event Step 1.1

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

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 13


Restrict Solution - Event Step 1.2

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

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 15


Restrict Solution - Event Step 1.3

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

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 17


Restrict Solution - Result

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

Restrict Post Restrict Change


Solution Assignment Solution Facets
Restrict Solution – Assignment & Event Step 2.1

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

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 21


Restrict Solution – Event Step 2.2

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

Restrict Post Restrict Change


Solution Assignment Solution Facets
Restrict Solution - Assignment

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

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 25


Result

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

• restrict characteristic values to a feasible solution

• do not base on a general evaluation direction

• are not bound to a sequence

• are only executed if needed (principle of justification)

• discard inferences as soon as justification is not longer given

... and constraints are easy to maintain ☺

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 27


Implicit Constraints - Examples
Numeric characteristics w/o specific master data domain

VCH_DEMO_NO_DOMAIN < 100


VCH_DEMO_NO_DOMAIN ≥ 0

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 29


Condition in Constraints-Restriction

X =1 If Y = 2
X is assigned to 2!

2 =1 If Y = 2
Valid solution enforces Y <> 2

Value 2 is excluded from domain of Y


© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 30
SAP
Demo: Solving Sudoku
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 32
SA
Summary
Summary

• Constraints are triggered by events

• Easy constraints are executed first, complex constraints are executed later

• AVC restricts the domain of the characteristics satisfying all constraints

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]

You might also like