CSCI5240 Combinatorial Search and Optimization with Constraints

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems Russell and Norvig: Chapter
Advertisements

This lecture topic (two lectures) Chapter 6.1 – 6.4, except 6.3.3
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
ICS-271:Notes 5: 1 Lecture 5: Constraint Satisfaction Problems ICS 271 Fall 2008.
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Mar, 4, 2015 Slide credit: some slides adapted from Stuart.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
CPSC 322, Lecture 14Slide 1 Local Search Computer Science cpsc322, Lecture 14 (Textbook Chpt 4.8) February, 3, 2010.
COMP171 Data Structure & Algorithm Tutorial 1 TA: M.Y.Chan.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
A game of logic where the player must assign the numbers 1..9 to cells on a 9x9 grid. The placement of the numbers must be such that every number must.
. Memory Management. Memory Organization u During run time, variables can be stored in one of three “pools”  Stack  Static heap  Dynamic heap.
1 Constraint Programming: An Introduction Adapted by Cristian OLIVA from Peter Stuckey (1998) Ho Chi Minh City.
Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Jim Little UBC CS 322 – CSP 1 September 27, 2014 Textbook §
Introduction to Job Shop Scheduling Problem Qianjun Xu Oct. 30, 2001.
10/9/2015COSC , Lecture 51 Real-Time Systems, COSC , Lecture 5 Stefan Andrei.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
Chapter 5 Constraint Satisfaction Problems
Stochastic greedy local search Chapter 7 ICS-275 Spring 2009.
1 Chapter 3: Finite Constraint Domains Where we meet the simplest and yet most difficult constraints, and some clever and not so clever ways to solve them.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Oct, 30, 2015 Slide credit: some slides adapted from Stuart.
An Introduction to Artificial Intelligence Lecture 5: Constraint Satisfaction Problems Ramin Halavati In which we see how treating.
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
CS182 Intelligent Machines: Reasoning, Actions and Plans Section 4.
Inference in Propositional Logic (and Intro to SAT) CSE 473.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
Honors Track: Competitive Programming & Problem Solving Seminar Topics Kevin Verbeek.
A structured walkthrough
CSCI5240 Combinatorial Search and Optimization with Constraints
Constraint Satisfaction Problems (CSPs) Introduction
Inference in Propositional Logic (and Intro to SAT)
Business System Development
Optimization Problems
CSC Modeling with FD Constraints
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Data Structure Interview Question and Answers
Session 3 Memory Management
Computer Science cpsc322, Lecture 13
CSCI5240 Combinatorial Search and Optimization with Constraints
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Object-Oriented Programming & Design Lecture 18 Martin van Bommel
Constraint Satisfaction
Introduction to Software Verification
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Other Models of Computation
Computer Science cpsc322, Lecture 13
SAT-Based Area Recovery in Technology Mapping
Chapter 1: Computer Systems
Proposal for Term Project Operating Systems, Fall 2018
Chapter 3: Finite Constraint Domains
Constraints and Search
Focus of the Course Object-Oriented Software Development
Chapter 3: Finite Constraint Domains
Constraint satisfaction problems
CSE 6408 Advanced Algorithms.
Artificial Intelligence
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
Knowledge Representation
Introducing JavaScript
Local Search Algorithms
CSE 153 Design of Operating Systems Winter 2019
Constraint satisfaction problems
Faster Extraction of High-Level Minimal Unsatisfiable Cores
IS 135 Business Programming
Consistency algorithms
Presentation transcript:

CSCI5240 Combinatorial Search and Optimization with Constraints Tutorial Notes 6

CSCI5240 Tutorial 6 Assignment 1 Feedback User-defined constraints Course Project

Assignment 1 Feedback Question 1 Prove that C is equivalent to: Hints: Propositional logic Transform to Conjunctive Normal Form (CNF) Resolution Rule Prove the disequality x != y is equivalent to : Hints: Use result from part (a) Divide into cases

Assignment 1 Feedback Question 2 3 solutions Question 3 Payoff is 7

Assignment 1 Feedback Write your model with mathematical notation you have to state what the variables and domains stand for can have some text to explain the notations refer to the model given in Problem 3a) give the objective function

ABC Path A letter touches previous letter either horizontally, vertically or diagonally A locates in one of these 8 cells. A locates in one of these 3 cells.  

Assignment 1 Feedback Different model vs Different implementation implementing the same model in a different way is not considered as a different model Programming Style proper comments and indentations Always include your name in source file Strictly follow the file naming and argument rules

User-defined Constraints Inherits from the class Propagator Define events on when to propagate Define domain reduction rules Handle How to post and initialize it, how to dispose it, how to copy it during cloning for search, and when to execute it

Write a user-defined constraint for “less”. Main Program Problem Variables: x, y Domains: D(x) = {1,2,3,4,5}, D(y) = {3} Constraint: x < y IntVar x(home, 1, 5); IntVar y(home, 3, 3); rel(home, x, IRT_LE, y); Write a user-defined constraint for “less”.

Example: less constraints Objective Create a user-defined constraint less less(home, x, y)  rel(home, x, IRT_RE, y)

Example: less constraints Domain Reduction Rules: less :

Recall From Lecture... ac_revise(c, D) Page. 69 ac_revise(c, D) if |vars(c)| = 2 then return D Removes values which are not arc consistent with c CSC5240 - Finite Constraint Domains

used by propagator and brancher Implementation Class class Less : public Propagator { protected: Int::IntView x0, x1; public: // posting // disposal // copying // cost computation // propagation }; void less(Space& home, IntVar x0, IntVar x1) { // constraint post function } used by propagator and brancher

Constructor Initialize data member Less(Space& home, Int::IntView y0, Int::IntView y1) : Propagator(home), x0(y0), x1(y1) { x0.subscribe(home,*this,Int::PC_INT_DOM); x1.subscribe(home,*this,Int::PC_INT_DOM); } static ExecStatus post(Space& home, Int::IntView x0, Int::IntView x1) { (void) new (home) Less(home,x0,x1); return ES_OK; propagation condition allocates memory from home

Propagation Condition Modification of a variable’s domain triggers a propagation event: Int::PC_INT_VAL: a value has been assigned to the variable, that is the variable is bounded Int::PC_INT_BND : the minimum (maximum) of the domain of the variable has increased (decreased) Int::PC_INT_DOM : the domain of the variable has been modified

Propagation Events X x = ? D(x) = { 1 , 2 , 3 , 4 } Int::PC_INT_DOM Remove 2 from domain ... x = ? X D(x) = { 1 , 2 , 3 , 4 } Int::PC_INT_DOM

Propagation Events X X x = ? D(x) = { 1 , 2 , 3 , 4 } Int::PC_INT_DOM Remove 4 from domain ... x = ? X X D(x) = { 1 , 2 , 3 , 4 } Int::PC_INT_DOM Int::PC_INT_BND

Propagation Events X X X x = 3 x = ? D(x) = { 1 , 2 , 3 , 4 } Remove 1 from domain ... x = ? x = 3 X X X D(x) = { 1 , 2 , 3 , 4 } Int::PC_INT_DOM Int::PC_INT_BND Int::PC_INT_VAL

if both are assigned, the propagator are subsumed Propagate Implement domain reduction rules virtual ExecStatus propagate(Space& home, const ModEventDelta&) { if (x0.le(home,x1.max()) == Int::ME_INT_FAILED) return ES_FAILED; if (x1.gr(home,x0.min()) == Int::ME_INT_FAILED) if (x0.assigned() && x1.assigned()) return home.ES_SUBSUMED(*this); else return ES_NOFIX; } less if both are assigned, the propagator are subsumed the propagator will be scheduled if one of its views have been modified.

Recall From Lecture... arc_consistent_3(C,D) W := D Page. 71 arc_consistent_3(C,D) Q := the set of primitive constraints from C while (Q not empty) do W := D remove a primitive constraint c from Q if ((D := ac_revise(c,D))  W) then Q := Q  {c’| vars(c)  vars(c’)  } endwhile return D CSC5240 - Finite Constraint Domains

Domain Accessors and Modifiers in(int) min() max() size() assigned() val() Domain Modifiers nq(home,int) eq(home,int) le(home,int) lq(home,int) gr(home,int) gq(home,int) Use val() only when the variable is bound! For more details, refer to the reference doc...

cancel the subscriptions if the propagator are subsumed Disposal virtual size_t dispose(Space& home) { x0.cancel(home,*this,Int::PC_INT_DOM); x1.cancel(home,*this,Int::PC_INT_DOM); (void) Propagator::dispose(home); return sizeof(*this); } cancel the subscriptions if the propagator are subsumed

an approximation of the real cost of the execution Cost Computation virtual PropCost cost(const Space&, const ModEventDelta&) const { return PropCost::binary(PropCost::LO); } an approximation of the real cost of the execution unary binary ternary

Constraint Post Function void less(Space& home, IntVar x0, IntVar x1) { // constraint post function Int::IntView y0(x0), y1(x1); if (Less::post(home,y0,y1) != ES_OK) home.fail(); } create integer variable views call the static propagator post function

Matching less constraint function Main Program IntVar x(home, 1, 5); IntVar y(home, 3, 3); less(home, x, y); Matching less constraint function

Course Project Free Topic in Constraint Programming Submit Project Proposal to Jimmy Before 7 Nov, 2013 (Thu) One page proposal with project title, your name and student ID and description Submit a Project Report Give a Presentation

Course Project: Performance Comparison Run time CPU time (UNIX) versus elapsed time (WINDOWS) For stochastic algorithm, you have to run the same problem instance for several times and show statistics Scalability Using different sizes of the problem Completeness First solution versus all solutions “Good” solution versus proof of optimality

Course Project: Performance Comparison Other measures (Approach Specific) Tree search algorithms: number of fails/backtracks/nodes Consistency algorithms: number of constraint checks Stochastic algorithms: e.g. number of flips (SAT solvers) Example: Strategy size = 20 size = 50 fails sec(s) … 1 2

Course Project: Performance Comparison Important Issues: FAIR comparison across different strategies Same platform/machine across experiments Same search time limit across strategies Perform experiments which are non-trivial and meaningful Example of trivial experiment: 3-Queens problem.

Course Project Past 5 Years (2008-2013) full papers at major conferences Principles and Practice of Constraint Programming (CP) International Joint Conference on Artificial Intelligence (IJCAI) National Conference on Artificial Intelligence (AAAI) European Conference on Artificial Intelligence (ECAI) Journal paper is allowed but not suggested.

Course Project CP full papers are around 15 pages. For IJCAI, AAAI, and ECAI, look for full papers (around 5-6 papers, double columns) under the section Constraints, Constraint Satisfaction, Search, and Satisfiability Read the abstract when choosing papers If you do not know something mentioned in the current reading paper, try to read the papers that are cited by the paper you are reading

Course Project CP proceedings(2008 – 2013) are available online through CUHK machines / VPN (http://springerlink.metapress.com/) http://www.springerlink.com/content/?k=Principles+and+Practice+of+Constraint+Programming&Content+Type=Books&MUD=MP You can also search for “Principles and Practice of Constraint Programming” in our CUHK library system. If you are outside CUHK network, please login the library system first

Course Project IJCAI proceedings (2009,2011,2013) are available online (http://www.ijcai.org/ )

Course Project AAAI proceedings are available online 2013 2012 2011 http://www.aaai.org/Library/AAAI/aaai13contents.php 2012 http://www.aaai.org/Library/AAAI/aaai12contents.php 2011 http://www.aaai.org/Library/AAAI/aaai11contents.php 2010 http://www.aaai.org/Library/AAAI/aaai10contents.php 2008 http://www.aaai.org/Library/AAAI/aaai08contents.php

Course Project ECAI proceedings are available online 2012 2010 2008 http://booksonline.iospress.nl/Content/View.aspx?piid=31572 2010 http://booksonline.iospress.nl/Content/View.aspx?piid=17702 2008 http://booksonline.iospress.nl/Content/View.aspx?piid=9905

Assignment 2 deadline 11 November 2013 11:59pm

END