Specialised (user defined) constraints in JChoco 2 examples: max and subtour elimination.

Slides:



Advertisements
Similar presentations
Slides by Peter van Beek Edited by Patrick Prosser.
Advertisements

Some Graph Algorithms.
This lecture topic (two lectures) Chapter 6.1 – 6.4, except 6.3.3
Traveling Salesperson Problem
The Knight’s Tour in Chess – Implementing a Heuristic Solution John R Gerlach The Knight’s Tour in Chess – Implementing a Heuristic Solution John R Gerlach.
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
CSE 373, Copyright S. Tanimoto, 2001 Graphs Graphs 2 Incidence and Adjacency Representing a graph with an adjacency matrix, an incidence matrix,
Using Sparse Matrix Reordering Algorithms for Cluster Identification Chris Mueller Dec 9, 2004.
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
CP2014: Teaching CP. Context Final Year 120 credits (1 credit approx 10 hours) 30 credit project 4 modules in semester 1 4 modules in semester 2.
CSE 373: Data Structures and Algorithms Lecture 19: Graphs III 1.
©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
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.
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part R5. Graphs.
Graph & BFS.
Chapter 9 Graph algorithms. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
CS 536 Spring Global Optimizations Lecture 23.
4/25/08Prof. Hilfinger CS164 Lecture 371 Global Optimization Lecture 37 (From notes by R. Bodik & G. Necula)
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2.
Prof. Fateman CS 164 Lecture 221 Global Optimization Lecture 22.
Graphs G = (V,E) V is the vertex set. Vertices are also called nodes and points. E is the edge set. Each edge connects two different vertices. Edges are.
MTH118 Sanchita Mal-Sarkar. Routing Problems The fundamental questions: Is there any proper route for the particular problem? If there are many possible.
Prof. Bodik CS 164 Lecture 16, Fall Global Optimization Lecture 16.
Graph Operations And Representation. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Constraint Satisfaction Problems
1 Constraint Programming: An Introduction Adapted by Cristian OLIVA from Peter Stuckey (1998) Ho Chi Minh City.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Network Models (2) Tran Van Hoai Faculty of Computer Science & Engineering HCMC University of Technology Tran Van Hoai.
Algorithm Efficiency CS 110: Data Structures and Algorithms First Semester,
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
An Algorithm for the Coalitional Manipulation Problem under Maximin Michael Zuckerman, Omer Lev and Jeffrey S. Rosenschein (Simulations by Amitai Levy)
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
1 ELEC692 Fall 2004 Lecture 1b ELEC692 Lecture 1a Introduction to graph theory and algorithm.
Representing and Using Graphs
Exact methods for ALB ALB problem can be considered as a shortest path problem The complete graph need not be developed since one can stop as soon as in.
CP Summer School Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules.
Graphs CSE 2011 Winter June Graphs A graph is a pair (V, E), where  V is a set of nodes, called vertices  E is a collection of pairs.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
1 Combinatorial Problem. 2 Graph Partition Undirected graph G=(V,E) V=V1  V2, V1  V2=  minimize the number of edges connect V1 and V2.
Chapter 5 Constraint Satisfaction Problems
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
2 Office hours: MWR 4:20-5:30 inside or just outside Elliott 162- tell me in class that you would like to attend. For those of you who cannot stay: MWR:
Arc consistency AC5, AC2001, MAC. AC5 A generic arc-consistency algorithm and its specializations AIJ 57 (2-3) October 1992 P. Van Hentenryck, Y. Deville,
Data Structures & Algorithms Graphs Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
Graphs 황승원 Fall 2010 CSE, POSTECH. 2 2 Graphs G = (V,E) V is the vertex set. Vertices are also called nodes and points. E is the edge set. Each edge connects.
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright All rights reserved Lecture 6 – Integer Programming Models Topics.
Graphs Upon completion you will be able to:
Lecture 6 – Integer Programming Models Topics General model Logic constraint Defining decision variables Continuous vs. integral solution Applications:
Car Sequencing Problem Assessed exercise 2 15% 26/11/2010.
1 CSC 384 Lecture Slides (c) , C. Boutilier and P. Poupart CSC384: Lecture 16  Last time Searching a Graphplan for a plan, and relaxed plan heuristics.
The minimum cost flow problem. Solving the minimum cost flow problem.
1 Data Structures and Algorithms Graphs. 2 Graphs Basic Definitions Paths and Cycles Connectivity Other Properties Representation Examples of Graph Algorithms:
Alternative Search Formulations and Applications
Graphs and Search other searches in addition to breadth-first/depth-first search in game trees search in optimization problems shortest path from vertex.
New Characterizations in Turnstile Streams with Applications
The minimum cost flow problem
Networks.
Can you draw this picture without lifting up your pen/pencil?
Integer Programming (정수계획법)
Algorithms + Data Structures = Programs -Niklaus Wirth
Walks, Paths, and Circuits
Graphs.
Integer Programming (정수계획법)
Graphs By Rajanikanth B.
Graphs G = (V, E) V are the vertices; E are the edges.
GRAPHS Lecture 17 CS 2110 — Spring 2019.
Heaps Chapter 6 Section 6.9.
Design Principles of Scalable Switching Networks
Presentation transcript:

Specialised (user defined) constraints in JChoco 2 examples: max and subtour elimination

Consider the following contraint This can be implemented in JChoco using primitives as follows

Due to Chris Unsworth

Could I define my own constraint to do this? Why would I want to do that? Possibly: more compact faster more propagation

Define a constraint called Max that extends AbstractLargeIntConstraint V[0] = max(v[1],v[2],…,v[n-1])

Methods to be implemented inf: lower bound sup: upper bound instantiate initiation removal of value V[0] = max(v[1],v[2],…,v[n-1])

A demo V[0] = max(v[1],v[2],…,v[n-1]) Cart before the horse?

Note: output always has a 4 or a 5 in it V[0] = max(v[1],v[2],…,v[n-1])

Backtrackable Variables (Stored*) We haven’t used them yet, but ….

Small TSP’s

The single successor model An array of n variables But this aint enough “single successor” model of a graph Limits what kind of graph can be modelled out-degree of 1

The single successor model NOT A TOUR! We need subtour elimination

Associate with each variable next[i] the following reversible variables When making an instantiation next[i] = j We now join the path that ends in i to path that starts with j If the path involves less that n vertices/cities next[e[j]] != s[i] i.e. we cannot close that loop! Yikes! Show me a picture!

next[1] = 5 s[1] = 0 e[0] = 1 e[5] = 7 s[7] = e[8] = 6 s[6] = 8

e[0] = 7 s[7] = e[8] = 6 s[6] = 8

e[0] = 7 s[7] = e[8] = 6 s[6] = 8 next[7] ≠ 0 Otherwise we have a subtour/loop This is the “propagation”. Note: this is a constraint that may be used in a richer problem

Example application: knight’s tour

Wot! Show me a picture!

Is there a dvo heuristic for this?

Warnsdorff's rule

Is there an alternative model for this?

A knights-graph with a degree sequence 2* that is connected i.e. adjacency matrix model of the graph

So? Jean-Francois Puget called this “the glass box” Note how this fits with AC5 Note that we need to consider state and backtracking Why bother?