CPM! Just do it! JChoco We jumped in, and took it for a spin Some counting problems Meeting scheduling problem … you got your hands dirty JChoco Meeting scheduling problem … you got your hands dirty • • • • • • Model and solve Reflect on alternative models Symmetries Heuristics Pre-processing Equitable graph colouring • with side constraints A surprisingly rich problem! Opening up the hood: part 1, search Opening up the hood: part 1, search So how does CP work? BT: Chronological BackTracking Thrashing! FC: forward checking Thrashing! CBJ: Conflict-directed BackJumping Thrashing! Opening up the hood: part 2, arc-consistency Opening up the hood: part 2, arc-consistency So how does CP work? Arc-consistency Definition (aka 2-consistency) Covered 1-2-3-Consistency Algorithms AC3 AC4/6/2001 AC5 Is AC a decision procedure? modelling We modelled some problems Meeting scheduling problem Team allocation number partitioning m-queens 75 integer sequence magic square sudoku jobshop scheduling Ramsey number bin packing Crossword Puzzle Orthogonal Latin Squares Crystal Maze knight’s tour Round-robin scheduling n-queens graph colouring We modelled some problems Dual or Hidden Variable encoding? We modelled some problems • • • • • • • • • Variables & their domains Constraints Identifying the decision variables Size of the model • number of variables, number of constraints • Use big-O Size of the search space (worst case) • Use big-O Symmetries • And how to eliminate if possible Heuristics Alternative models • Swap the perspective variable/values? • Replace constraints with variables? • Did this in crossword puzzle • Zero/one possible? • Did this in team allocation and others Channeling between models • See above phase transition phenomena Where are the hard problems? Constrainedness? Who cares? In optimisation, as a heuristic, in solving problems heuristics Variable and value ordering heuristics Static, topological properties Fail-first, and it’s realisation Constrainedness Dual viewpoint heuristics Promise Regret Domain Specific (example JSSP slack-based, Warnsdorff) Specialised constraints specialised constraints • max • sub-tour elimination • Knight’s tour •… • the glass box local search Local search (aka neighbourhood search) HC, SA, TS, GLS, GA, ACO, … Why we need them escape local optima Problems in using them incompleteness, move operators, evaluation/fitness functions, tuning parameters, Problems in using them in CP aka meta-heuristics Search again Limited Discrepancy Search Search again lds • motivation for LDS • when might we use it? • when should we not use it? • what happens when problem is unsat? Parallel search • Amdahl’s law • How much speed up can we get? • Satisfiable v Unsatisfiable problems • Optimisation • Superlinear? • BitSet parallelism • How to split up work • Static • Embarrassingly • Dynamic work stealing/donation change of representation change of representation dual and hidden variable encoding Crossword puzzle, turn constraints into variables Interchange values and variables Zero/one? SAT encoding of Graph Colouring Levels of consistency consistency • Node Consistency (NC) • Arc-consistency (AC) • Path Consistency (PC) • Generalised arc-consistency (GAC) • Bounds consistency • Inverse Path Consistency (IPC aka PIC) • Singleton Arc-consistency (SAC) • … and others Mechanics of choco Mechanics of choco homework Ramsey & max Local Search demo m-queens 75 integers summary summary theory • csp <v,c,d> and it’s complexity • search (bt, fc, cbj, …) • thrashing • arc-consistency • levels of consistency • heuristics • local search & lds & parallel search • dual & hidden variables • sat • phase transition phenomena & constrainedness Modelling & Solving Problems practice number partitioning magic square jobshop scheduling Crystal Maze Meeting Scheduling Orthogonal Latin Squares n-queens graph colouring bin packing knight’s tour Modelling & Solving Problems practice • variables (enumerated/bound/setsVar) and their domains • constraints (neq, allDiff, ifOnlyIf, …) • decision variables • what propagation might take place • size of the encoding/model (how it scales with problem size) • heuristics (dynamic/static, variable/value) • size of the search/state space • how search goes (example was knight’s tour) • alternative models (dual? hidden? values as variables?) • optimisation (with maximise/minimise, seqn of decision problems) • dealing with conflicts (soft constraints & penalties) • symmetry breaking (ramsey, bin packing, …) • redundant constraints (magic square, MOLS …) • what will make problems hard to solve and what will make them easy? Where to next? Where to next? • smarter (explanation/interaction) • local search (comet & beyond) • exploiting multi-cores (Moore’s law ends July 2017) • in propagation • in search • easier to use (Miguel & Frisch) • don’t need a BSc, MSc, MRes, PhD • a killer app • constraint spread sheet? • something on a phone? • you