Set Domain Solvers. 2 ic_sets - the set constraint solver  Load the ic_sets library by using :- lib(ic_sets). at the beginning of your code, or type.

Slides:



Advertisements
Similar presentations
Introduction to Set Theory
Advertisements

Introduction. IC-Parc2 ECLiPSe Components Constraint Logic Programming system, consisting of  A runtime core Data-driven computation, backtracking, garbage.
More Set Definitions and Proofs 1.6, 1.7. Ordered n-tuple The ordered n-tuple (a1,a2,…an) is the ordered collection that has a1 as its first element,
But Shaun’s already proved P equals NP. Can’t we move onto quantified SAT? Woof!
L1 Supplementary Notes Page 1 Selection Sort Comparison Counting.
1 Optimisation Although Constraint Logic Programming is somehow focussed in constraint satisfaction (closer to a “logical” view), constraint optimisation.
1 2. Constraint Databases Next level of data abstraction: Constraint level – finitely represents by constraints the logical level.
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department.
Sets 1.
Sets 1.
CSE115/ENGR160 Discrete Mathematics 02/14/12 Ming-Hsuan Yang UC Merced 1.
Vocabulary word (put this word on the back of the card.) THIS WILL BE THE DEFINITION – FILL IN THE BLANKS ON THE VOCABULARY CARDS PROVIDED.
Chapter 2 The Basic Concepts of Set Theory © 2008 Pearson Addison-Wesley. All rights reserved.
Discrete Mathematics Unit - I. Set Theory Sets and Subsets A well-defined collection of objects (the set of outstanding people, outstanding is very subjective)
1 Constraint Programming: An Introduction Adapted by Cristian OLIVA from Peter Stuckey (1998) Ho Chi Minh City.
2.1 – Sets. Examples: Set-Builder Notation Using Set-Builder Notation to Make Domains Explicit Examples.
Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from.
A Brief Summary for Exam 1 Subject Topics Propositional Logic (sections 1.1, 1.2) –Propositions Statement, Truth value, Proposition, Propositional symbol,
The Interval Constraint Solver For integer and real variables.
9.3 Addition Rule. The basic rule underlying the calculation of the number of elements in a union or difference or intersection is the addition rule.
Definition and Representation A set is a well-defined collection of objects; The objects are called elements or members of the set; A set can be represented.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
1. Set Theory Set: Collection of objects (“elements”) a  A “a is an element of A” “a is a member of A” a  A “a is not an element of A” A = {a 1, a 2,
Slide Chapter 2 Sets. Slide Set Concepts.
Chapter 2 Section 1 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
Unit 2 Sets.
SECTION 2-3 Set Operations and Cartesian Products Slide
ELEMENTARY SET THEORY.
Set Operations Chapter 2 Sec 3. Union What does the word mean to you? What does it mean in mathematics?
Sets 2/10/121. What is a Set? Informally, a collection of objects, determined by its members, treated as a single mathematical object Not a real definition:
Rosen 1.6, 1.7. Basic Definitions Set - Collection of objects, usually denoted by capital letter Member, element - Object in a set, usually denoted by.
Sets.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
Discrete Mathematics Set.
November 2003Computational Morphology III1 CSA405: Advanced Topics in NLP Xerox Notation.
Set Theory Concepts Set – A collection of “elements” (objects, members) denoted by upper case letters A, B, etc. elements are lower case brackets are used.
CSCI 115 Course Review.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Set Operations Section 2.2.
Section 1.2 – 1.3 Outline Intersection  Disjoint Sets (A  B=  ) AND Union  OR Universe The set of items that are possible for membership Venn Diagrams.
Fr: Discrete Mathematics by Washburn, Marlowe, and Ryan.
Discrete Mathematics CS 2610 August 31, Agenda Set Theory Set Builder Notation Universal Set Power Set and Cardinality Set Operations Set Identities.
Semilattices presented by Niko Simonson, CSS 548, Autumn 2012 Semilattice City, © 2009 Nora Shader.
Thinking Mathematically Venn Diagrams and Set Operations.
The Basic Concepts of Set Theory. Chapter 1 Set Operations and Cartesian Products.
The set of whole numbers less than 7 is {1, 2, 3, 4, 5, 6}
Sets Finite 7-1.
CSNB 143 Discrete Mathematical Structures
Sets Section 2.1.
Ch 6.5 Solving Compound Inequalities Involving “OR”
CSE15 Discrete Mathematics 02/15/17
The Basic Concepts of Set Theory
Symbolic Solver.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
CSE 2353 – September 22nd 2003 Sets.
Exercises Show that (P  Q)  (P)  (Q)
Algebra 1 Section 1.1.
Introductory Material
The Basic Concepts of Set Theory
ICS 253: Discrete Structures I
دوره‏ی ضمن خدمت کشوری ریاضی پایه‏ی نهم مرداد 1394.
A Brief Summary for Exam 1
Discrete Mathematics CS 2610
More about Sets.
Sequences and Summation Notation
Lecture Sets 2.2 Set Operations.

Sets, Unions, Intersections, and Complements
Introductory Material
Presentation transcript:

Set Domain Solvers

2 ic_sets - the set constraint solver  Load the ic_sets library by using :- lib(ic_sets). at the beginning of your code, or type lib(ic_sets). at the top-level ECLiPSe prompt.  Sets must be finite and contain only integers  We write sets as sorted lists  Note: there is another set solver lib(conjunto) which is being phased out, and lib(fd_sets) which is identical to ic_sets, but works with lib(fd)

3 Functionality The ic_sets library implements  variables with finite integers set domains  basic constraints over set expressions  constraints over set cardinality and weights  a search primitive The ic_sets library implements  variables with finite integers set domains  basic constraints over set expressions  constraints over set cardinality and weights  a search primitive

4 Set domain variables  An integer (ground) set X = [1,7,12,19]  A set variable Set :: [7]..[1,7,12,19] attaches an initial domain to a variable or intersect their old domain with the new one.  Set variables have a lower and upper bound Both bounds are (ground) sets lower bound: set of elements that are definitely in the set upper bound: set of elements that may be in the set They also have a separate lower and upper bound on cardinality.  An integer (ground) set X = [1,7,12,19]  A set variable Set :: [7]..[1,7,12,19] attaches an initial domain to a variable or intersect their old domain with the new one.  Set variables have a lower and upper bound Both bounds are (ground) sets lower bound: set of elements that are definitely in the set upper bound: set of elements that may be in the set They also have a separate lower and upper bound on cardinality.

5 The basic set of constraints  X in S, X notin S Set membership.  S1 sameset S2, S1 subset S2, S1 disjoint S2 Set equality, subset, disjointness.  all_union(Sets,Union), all_disjoint(Sets) Generalised union and disjointness.  #(Set, Card), weight(Set, ElementWeights, Weight) Set cardinality and set weight.  Set expressions are allowed: Intersection S1 /\ S2, Union S1 \/ S2, Difference S1 \ S2  X in S, X notin S Set membership.  S1 sameset S2, S1 subset S2, S1 disjoint S2 Set equality, subset, disjointness.  all_union(Sets,Union), all_disjoint(Sets) Generalised union and disjointness.  #(Set, Card), weight(Set, ElementWeights, Weight) Set cardinality and set weight.  Set expressions are allowed: Intersection S1 /\ S2, Union S1 \/ S2, Difference S1 \ S2

6 Bound propagation  Constraints affect set bounds: ?- S::[]..[1,2,3,4,5]. S = S{([].. [1, 2, 3, 4, 5]) : C{[0.. 5]}} yes. ?- S::[]..[1,2,3,4,5], 3 in S, 5 notin S. S = S{[3] \/ ([].. [1, 2, 4]) : C{[1.. 4]}} yes. ?- S::[]..[1,2,3,4,5], S subset [1,5,6]. S = S{([].. [1, 5]) : C{[0.. 2]}} yes. ?- S::[2,4]..[1,2,3,4,5], #(S,2). S = [2, 4] yes.  Constraints affect set bounds: ?- S::[]..[1,2,3,4,5]. S = S{([].. [1, 2, 3, 4, 5]) : C{[0.. 5]}} yes. ?- S::[]..[1,2,3,4,5], 3 in S, 5 notin S. S = S{[3] \/ ([].. [1, 2, 4]) : C{[1.. 4]}} yes. ?- S::[]..[1,2,3,4,5], S subset [1,5,6]. S = S{([].. [1, 5]) : C{[0.. 2]}} yes. ?- S::[2,4]..[1,2,3,4,5], #(S,2). S = [2, 4] yes.

7 Basic search support  insetdomain(SetVar, Options…) Try to instantiate SetVar to a ground set. [eclipse 23]: A :: []..[1,2,3,4,5], insetdomain(A,_,_,_). A = [1, 2, 3, 4, 5] More? (;) A = [1, 2, 3, 4] More? (;) A = [1, 2, 3, 5] More? (;)  insetdomain(SetVar, Options…) Try to instantiate SetVar to a ground set. [eclipse 23]: A :: []..[1,2,3,4,5], insetdomain(A,_,_,_). A = [1, 2, 3, 4, 5] More? (;) A = [1, 2, 3, 4] More? (;) A = [1, 2, 3, 5] More? (;)

8 Set example – Steiner triplets  Ternary Steiner system of order n: the set of triplets taking values between 1 and n such that all pairs included in any triplets are different.   a triplet can share at most one number with any other triplet.  Set has n(n-1)/6 triplets.  Not easy to express generically (for any n) with fd only….

9 Steiner Triplets (Program) :- lib(ic_sets). steiner(N, LS) :- NB is N * (N-1) // 6, % compute number of set variables needed intsets(LS, NB, 1, N), % NB sets can take values between 1 and N ( foreach(S,LS) do #(S,3) ), % sets are triplets ( fromto(LS,[S1|Ss],Ss,[]) do ( foreach(S2,Ss), param(S1) do % no triplet can share more than one number with another #(S1 /\ S2,C), ic: (C #=< 1) ) ), label_sets(LS). label_sets([]). label_sets([S | LS]) :- insetdomain(S,_,_,_), label_sets(LS).