DM841 Discrete Optimization Part II Lecture 3
Introduction to Gecode
Marco Chiarandini
Department of Mathematics & Computer Science University of Southern Denmark
Introduction to Gecode Marco Chiarandini Department of Mathematics - - PowerPoint PPT Presentation
DM841 Discrete Optimization Part II Lecture 3 Introduction to Gecode Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Outline Solving CSP Overview 1. Solving CSP Overview 2 Outline
Department of Mathematics & Computer Science University of Southern Denmark
Solving CSP – Overview
2
Solving CSP – Overview
3
Solving CSP – Overview
◮ Search tree with branching factor at the top level nd and at the next
◮ Insight: CSP is commutative in the order of application of any given set
◮ Hence we can consider search algs that generate successors by
4
Solving CSP – Overview
5
Solving CSP – Overview
◮ No need to copy solutions all the times but rather extensions and undo
◮ Since CSP is standard then the alg is also standard and can use general
◮ Backtracking is uninformed and complete. Other search algorithms may
6
Solving CSP – Overview
7
Solving CSP – Overview
◮ Select-Initial-Unassigned-Variable
◮ Select-Unassigned-Variable
◮ Order-Domain-Values
8
Solving CSP – Overview
9
Solving CSP – Overview
◮ Solve in Gecode the problem:
◮ Repeat the analysis on this other instance of the problem:
10
Solving CSP – Overview
12
Solving CSP – Overview
◮ Forward checking ◮ Bounds consistency ◮ Domain consistency
13
Solving CSP – Overview
14
Solving CSP – Overview
◮ Argument: list of variables ◮ Meaning: variables are pairwise different ◮ Reasoning: Forward Checking (FC)
◮ When variable is assigned to value, remove the value from all other
◮ If a variable has only one possible value, then it is assigned ◮ If a variable has no possible values, then the constraint fails ◮ Constraint is checked whenever one of its variables is assigned ◮ Equivalent to decomposition into binary disequality constraints 15
Solving CSP – Overview
16
Solving CSP – Overview
17
Solving CSP – Overview
◮ Take each interval of possible values, say size N ◮ Find all K variables whose domain is completely contained in interval ◮ If K > N then the constraint is infeasible ◮ If K = N then no other variable can use that interval ◮ Remove values from such variables if their bounds change ◮ If K < N do nothing ◮ Re-check whenever domain bounds change
18
Solving CSP – Overview
19
Solving CSP – Overview
◮ Bounds consistency only considers min/max bounds ◮ Ignores "holes" in domain ◮ Sometimes we can improve propagation looking at those holes
20
Solving CSP – Overview
◮ A Matching is subset of edges which do not coincide in any node ◮ No matching can have more edges than number of variables ◮ Every solution corresponds to a maximal matching and vice versa ◮ If a link does not belong to some maximal matching, then it can be
21
Solving CSP – Overview
◮ Also called generalized arc consistency (GAC) ◮ or hyper arc consistency
22
Solving CSP – Overview
◮ NO! This extracts all information from this one constraint ◮ We could perhaps improve speed, but not propagation ◮ But possible to use different model ◮ Or model interaction of multiple constraints
23
Solving CSP – Overview
24
Solving CSP – Overview
◮ This does not always happen ◮ Sometimes, two methods produce same amount of propagation ◮ Possible to predict in certain special cases ◮ In general, tradeoff between speed and propagation ◮ Not always fastest to remove inconsistent values early ◮ But often required to find a solution at all
25
Solving CSP – Overview
◮ chronological backtracking, the most recent decision point is revisited ◮ backjumping, backtracks to the most recent variable in the conflict set
26
Solving CSP – Overview
◮ Naive approach: find all solutions and choose the best ◮ Branch and Bound approach
◮ Solve a modified Constraint Satisfaction Problem by setting an (upper)
2
27
Solving CSP – Overview
◮ Discrete variables with finite domain:
◮ Discrete variables with infinite domains:
◮ Variables with continuous domains (time intervals)
◮ structured domains (eg, sets, graphs)
28