Download presentation

Presentation is loading. Please wait.

Published byLeroy Gray Modified over 2 years ago

1
Course Summary What have we learned and what are we expected to know?

2
Overview Introduction Modelling in MiniZinc Finite Domain Constraint Solving Search Linear Programming and Network Flow Mixed Integer Programming Boolean Satisfiability Lazy Clause Generation Course Summary + Revision

3
Modelling

4
Modelling Approaches Approaches to modelling –traditional language and constraint-solving library –OO language with high-level library –constraint programming language –mathematical programming language –embedded domain specific language Strengths and weaknesses of approaches

5
MiniZinc Basics Variables: var int: x; Parameters: int: n; Types: int, float, bool, string, arrays + sets Arithmetic expressions: x + y mod z - 3 Data files (.dzn) Structure of a model (items): –include, output, variable declaration, assignment, constraint, solve

6
Comprehensions + Iteration Comprehension –[ expr | generator1, generator2 … where boolexpr] Iteration –forall(generator1, generator2 … where boolexpr)(expr) –is equivalent to –forall([expr |generator1, generator2…where boolexpr]) Usable for any predicate/function on an array: –exists, alldifferent, sum, product, …

7
Constraints Basic constraints: =, <, <= Complex combinations: /\, \/, ->, not Array constraints: a[i] where i is a variable bool2int Constraints for sets: –union, intersect, subset, card, … Assertions If-then-else-endif

8
Predicates + Tests Capturing a reusable complex constraint Global constraints: –alldifferent, inverse, cumulative, table, regular User-defined constraints Question: what is the difference between a predicate and test?

9
Complex Predicates Reflection Functions: –information about array indices and variable domains –index_set, index_set_2of3, lb, ub, dom, lb_array, … Local variables: –predicate even(var int:x) = let { var int: y } in x = 2*y; Local parameters must be initialized No local variables in a negative context

10
Partial Functions Question: What is the expected behaviour for –constraint a[i] >= 2 -> a[i] <= 3; Relational semantics –partial function application leads to false at nearest enclosing Boolean context

11
Modelling Considerations Bound your variables Write efficient loops User global constraints where applicable Add redundant constraints –that cause extra propagation A dual viewpoint of the problem can help –channel the two viewpoints

12
Key Skills Interpret MiniZinc models –understand what they mean Write MiniZinc models –from an English description of the problem –including complex loops and output –understand and use the globals studied –write complex predicate definitions

13
Finite Domain Constraint Solving

14
Constraint Satisfaction Problems CSP: –Variables –Finite Domains –Constraints Backtracking Search –pruning using partial satisfiability

15
Consistency Node consistency –unary constraints: –remove invalid values –only require one application per constraint Arc consistency –binary constraints –remove unsupported values –requires fixpoint Domain consistency –n-ary constraints –removes all values that are not part of a solution –NP-hard for many constraints

16
Bounds Consistency Only maintain lower + upper bounds (bounds(Z)) Relax consistency to use reals (bounds(R)) More efficient (linear propagation for linears) Less pruning Propagation Rules –inequalities to determine bounds propagation x = abs(y): –x ≥ 0, x ≤ max(ub(y), -lb(y)), –y ≥ (if lb(y) ≥ -lb(x) then lb(x) else –ub(x)) –y ≤ (if ub(y) ≤ lb(x) then –lb(x) else ub(x))

17
Propagation Propagator: mapping from domain to domain –correct: does not remove solutions –checking: answers false when all variables fixed and not solution –may not implement any notion of consistency! Propagation solving: –run all propagators to fixpoint –avoid rerunning propagators that must be at fixpoint events, idempotence

18
Complex Constraints Complex constraints \/ -> … are flattened –broken into reified components Reified constraints: –Boolean reflects if constraint holds –e.g. b x <= y Complex constraints propagate weakly –compare x = abs(y) with b1 x = y, b2 x = -y, b1 \/ b2

19
Global Constraints Individual propagation algorithms alldifferent : –naïve: equal to decomposition but faster –domain: based on maximal matching element : (array access with variable index) –domain consistent cumulative –many different propagation algorithms –timetable: compulsory parts reasoning

20
Optimization Retry optimization –restart when you find a new solution Branch and bound –add a new bound during search

21
Key Skills Define, explain, compare –consistencies, backtracking search, propagators, optimization search Execute propagation algorithm Create propagators for given constraint Reason about global constraint propagation

22
Search

23
Basic Search Labeling –Choose a variable: var input_order, first_fail, smallest, max_regret … –Choose a value: val indomain_min, indomain_random, indomain_median… –Add var = val ; var ≠ val Splitting –Choose variable: var –Choose split point: val –Add var ≤ val ; var > val

24
Search Considerations Which variables to search on? Variable selection changes the search tree Value selection reorders it: move solutions left Complex search strategies –seq_search : one search then another Comparing search strategies –time, choices, fails –usually needs experimentation

25
Search Techniques Restarts + Heavy tailed behaviour –types of restart Incomplete Search: –limits on fails, times, choices –limited discrepancy search Autonomous Search: –dom_w_deg –impact –activity

26
Key Skills Write and explain MiniZinc search annotations Reason about and compare search strategies Suggest appropriate searches for a model Explain advanced search techniques

27
Linear Programming and Network Flow

28
Linear Programming Form: Slack variables: to make equations Replacing unconstrained variables Basic Feasible Solution: –normal form illustrating a solution Simplex algorithm –repeatedly pivot to a better solution –shadow prices A first feasible solution –artificial variables

29
Network Flow A case where simplex solves integer problems sources, sinks, flows Form: where A has one -1 and one 1 per col & Σ b = 0

30
Network Simplex Construct a feasible tree –auxiliary graph (artificial variables) Replace one edge (pivot) that improves flow Cycling: strong pivots by taking in direction Too much supply: add artificial demand (dump)

31
Key Skills Define and explain the key concepts –linear program, basic feasible solution, pivot, network flow problem, network pivot, feasible tree Put a problem into simplex form Execute the two phase simplex algorithm Map a problem to network flow form (where possible) Execute the network flow algorithm

32
Mixed Integer Programming

33
MIP Problems Form: where x are integer, y are real Integer Programs: no y 0-1 Integer Problems: x i in {0,1} Modelling in MIP –Boolean constraints –Reified linears –alldifferent, element,

34
Solving Mixed Integer Programs Linear Relaxation Branch and Bound –Choosing branching variable, fathoming Cutting Planes methods –Generating cutting planes –Dual simplex (also for B&B) Branch and Cut –simplification methods (preprocessing) –cutting planes (cover cuts)

35
Key Skills Model and solve problems in MIP using MiniZinc –model complex constraints using linear inequalities and 0-1 variables Solve small MIP problems –execute branch and bound –create Gomory cuts –execute the dual simplex –preprocess (simplify) MIP problems Explain the MIP solving methods

36
Boolean Satisfiability

37
Boolean Satisfiability Problems Conjunctive Normal Form (CNF) SAT problems –3SAT, 2SAT Resolution Unit resolution, unit propagation Implication Graph –record why a new literal became true!

38
Solving SAT Problems DPLL: Davis-Putnam-Logemann-Loveland –backtracking search with unit propagation Nogood Learning –choice of nogoods –1UIP nogoods Backjumping Activity: what participated in failure Activity-based search

39
Modelling for SAT Boolean expressions Modelling integers Cardinality constraints –BDD based representation –Binary arithmetic (adder) representation –Unary arithmetic (sorting network) representation Sorting Networks Pseudo-Boolean constraints

40
Key Skills Modelling restricted problems using SAT in MiniZinc Explain and execute DPLL SAT solving –unit propagation –1UIP nogood generation –backjumping Model cardinality constraints in SAT Compare and contrast Boolean models.

41
Lazy Clause Generation

42
Representing integers: –bounds literals, equation literals, –domain clauses Explaining propagation Explaining failure Propagation implication graph 1UIP nogoods Backjumping

43
Lazier Clause Generation Lazy variable generation: –array: generate equation literals on demand –list: generate both on demand Views: a way to reduce the number of variables –map accesses/updates on views to base var Lazy Explanation –deletion of explanations –generating only needed explanations

44
LCG + Globals Globality of Nogood Learning Globals by Decomposition –advantages and disadvantages –which decomposition? Explaining Globals –choices in how to explain –what is the best explanation Search –nogoods work for all search

45
Key Skills Compare and contrast LCG with SAT and FD solving Define explaining propagators Execute lazy clause generation Discuss variations on lazy clause generation Examine issues for globals in LCG –decomposition, choice of propagation

46
Course Summary

47
Importance Introduction: LOW Modelling in MiniZinc: CRITICAL Finite Domain Constraint Solving: HIGH Search: MEDIUM Linear Programming and Network Flow: LOW Mixed Integer Programming: HIGH Boolean Satisfiability: MEDIUM Lazy Clause Generation: MEDIUM Course Summary + Revision: CRITICAL

48
Exam Questions Look at previous exams –modelling in Sicstus Prolog: NO –constraint logic programming: NO –constraint solvers in general: NO –the rest YES including modelling questions (MiniZinc) Workshop + Project Questions Questions in Lectures Exercises in Slides

49
The Exam My exams: –tend to be a bit long –have some hard questions (a) Don’t Panic –a hard/long exam means standardization up (b) Do the easiest mark/time questions first –for what you find easy (c) Attend even if you think you havent passed project hurdle –hurdles can always be relaxed

50
Good Luck!

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google