Constraint Reasoning - PowerPoint PPT Presentation

About This Presentation
Title:

Constraint Reasoning

Description:

Constraint Reasoning Florida Institute of Technology Computer Science Chapter 1) Introduction Constraint Satisfaction Problem(CSP) is an important sub-field of the ... – PowerPoint PPT presentation

Number of Views:96
Avg rating:3.0/5.0
Slides: 29
Provided by: csFitEdu1
Learn more at: https://cs.fit.edu
Category:

less

Transcript and Presenter's Notes

Title: Constraint Reasoning


1
Constraint Reasoning
Florida Institute of Technology Computer Science
2
Chapter 1) Introduction
  • Constraint Satisfaction Problem(CSP) is an
    important sub-field of the artificial
    intelligence. CSP appears in many areas, for
    instance in computer vision, in resource
    allocation, in scheduling and in temporal
    reasoning.
  • What is a constraint satisfaction problem
  • A CSP is a problem composed of a finite set of
    variables, each of which is associated with a
    finite domain, and a set of constraints.
  • The task is to assign a value to each variable
    satisfying all the constraints.
  • For example the N-queens problem the problem
    is to place eight queens on an 8x8 chessboard
    satisfying the constraint that no two queens
    should be on the same row, column or diagonal.

3
Example 2-car sequencing problem
  • In a car production scenario, cars are placed on
    conveyor belts which move through different work
    areas.
  • A production line is normally required to produce
    cars of different models. The number of cars
    required for each model is called the production
    requirement.
  • Each work area is constrained by its resource
    constraint or Capacity constraint.
  • variable - the car model of one position in the
    conveyor belt (I.e. if there are n cars to be
    scheduled, the problem consists of n variables).
  • domain - the set of car models, for example from
    model A to D.
  • The task - to assign a value (a car model) to
    each variable (a position in the conveyor belt),
    satisfying both the production requirements and
    capacity constraints.

4
(No Transcript)
5
Definition of domain and labels
  • Definition 1-1The domain of a variable is a set
    of all possible values that can be assigned to
    the variable. If x is a variable, then we use Dx
    to denote the domain of it.
  • Definition 1-2A label is a variable-value pair
    that represents the assignment of the value to
    the variable. We use ltx,vgt to denote the label of
    assigning the value v to the variable x. ltx, vgt
    is only meaningful if v is in the domain of x
    (I.e. v ? Dx).
  • Definition 1-3A compound label is the
    simultaneous assignment of values to a (possibly
    empty) set of variables. We use
    (ltx1,v1gtltx2,v2gtltxn,vngt)to denote the compound
    label of assigning v1, v2, , vn to x1, x2, , xn
    respectively.
  • Definition 1-4A k-compound label is a compound
    label which assigns k values to k variables
    simultaneously.

6
Definition of domain and labels
  • Definition 1-5If m and n are integers such that
    mltn, then a projection of an n-compound label N
    to an m-compound label M, written as
    projection(N,M), (read as M is a projection of
    N) if the labels in M all appear in N.
  • Definition 1-6The variables of a compound label
    is the set of all variables which appear in that
    compound label.

7
Definition of constraints
  • Definition 1-7A constraint on a set of
    variables is conceptually a set of compound
    labels for the subject variables. For
    convenience, we use Cs to denote the constraint
    on the set of variables S.
  • Definition 1-8The variables of a constraint is
    the variables of the members of the constraint.
  • Definition 1-9If m and n are integers such that
    mltn, then an m-constraint M is subsumed-by an
    n-constraint N(written as subsumed-by(M,N)) if
    for all elements c in M there exists an element d
    in N such that c is a projection of d.

8
Definitions of satisfiability
  • Definition 1-10aIf the variables of the
    compound label x are the same as those variables
    of the elements of the compound labels in
    constraint C, then x satisfies C if and only if X
    is an element of C.
  • Definition 1-10bsatisfies(ltx,vgt,Cx) ? (ltx,vgt) ?
    Cx
  • Definition 1-11Given a compound label L and a
    constraint C such that the variables of C are a
    subset of the variables of L, the compound label
    L satisfies constraint C if and only if the
    projection of L onto the variables of C is an
    element of C.

9
Constraint satisfaction problem
  • Definition 1-12A constraint satisfaction
    problem is a triple (Z, D, C)where, Za
    finite set of variables x1, x2, , xnDa
    function which maps every variable in Z to a set
    of objects of arbitrary typeD Z?finite set of
    objects (of any type)We shall take Dxi as the
    set of objects mapped from xi by D. We call these
    objects possible values of xi and the set Dxi the
    domain of xiCa finite (possibly empty) set of
    constraints on an arbitrary subset of variables
    in Z. In other words, C is a set of sets of
    compound lables. We use csp(P) to denote that P
    is a constraint satisfaction problem.

10
Task in a CSP
  • Definition 1-13A solution tuple of a CSP is a
    compound label for all those variables which
    satisfy all the constraints.
  • Depending on the requirements of an application,
    CSPs can be classified into the following
    categories(1) CSPs in which one has to find any
    solution tuple(2) CSPs in which one has to find
    all solution tuples.(3) CSPs in which one has to
    find optimal solutions, where optimality is
    defined according to some domain knowledge.
    Optimal or near optimal solutions are often
    required in scheduling.

11
Constraint
representation and binary CSPs
  • Definition 1-14A binary CSP, or binary
    constraint problem, is a CSP with unary and
    binary constraints only. A CSP with constraints
    not limited to unary and binary will be referred
    to as a general CSP.
  • Definition 1-15A graph is a tuple (V,U) where V
    is a set of nodes and U(?VxV) is a set of arcs. A
    node can be an object of any type and an arc is a
    pair of nodes. For convenience, we use graph(G)
    to denote that G is a graph.An undirected graph
    is a tuple (V,E) where V is a set of nodes and E
    is a set of edges, each of which being a
    collection of exactly two elements in V.
  • Definition 1-16For all graphs (V,E), node x is
    adjacent to node y if and only if (x,y) is in E.

12
Graph-related concepts
  • Definition 1-17A hypergraph is a tuple (V,E)
    where V is a set of nodes and E is a set of
    hyperedges, each of which is a set of nodes. For
    convenience we use hypergraph((v,E)) to denote
    that (V,E) is a hypergraph, hyperedges(F,V) to
    denote that F is a set of hyperedges for the
    nodes V (I.e. F is a set of set of nodes in V),
    and nodes_of(e) to denote the nodes involved in
    the hyperedge e.
  • Definition 1-18The constraint hypergraph of a
    CSP (Z, D, C) is a hypergraph in which each node
    represents a variable in Z, and each hyperedge
    represents a constraint in C. We denote the
    constraint hypergraph of a CSP P by H(P). If P is
    a binary CSP and we exclude hyperedges on single
    nodes, then H(P) is a graph. We denote the
    constraint graph of a CSP by G(P).

13
Graph-related concepts
  • Definition 1-20A path of length n is a path
    which goes through n1 (not necessarily distinct)
    nodes.
  • Definition 1-21A node y is accessible from
    another node x if there exists a path from x to
    y.
  • Definition 1-22A graph is connected if there
    exists a path between every pair of nodes.
  • Definition 1-23A loop in a graph is an edge or
    an arc which goes from a node to itself, I.e. a
    loop is (x,x), where x is a node.
  • Definition 1-24A network is a graph which is
    connected and without loops.
  • Definition 1-25A cycle is a path on which
    end-points coincide.

14
Graph-related concepts
  • Definition 1-26An acyclic graph is a graph
    which has no cycles.
  • Definition 1-27A tree is a connected acyclic
    graph
  • Definition 1-28A binary relation(lt) on a set S
    is called an ordering of S when it is
    irreflexive, asymmetric and transitive.
  • Definition 1-29A set S is totally ordered if
    every two elements in S are ordered. Such an
    ordering is called a total ordering of the
    elements in S.

15
The N-queens problem
  • This N-queen problem has very specific features
  • firstly, it is a binary constraints,
  • secondly, every variable is constrained by every
    other variable,
  • More importantly, constraint get looser as N
    grows larger.
  • Such features may not be shared by many other
    CSPs therefore, benchmarks on different
    algorithms produced using this problem must be
    interpreted with caution.
  • Problem formalization
  • The set of variables Z Q1, Q2, , Q8
  • Domain DQ1 DQ2 DQ8 1,2,3,4,5,6,7,8
  • Constraint (1) ?i,j if Qia and Qjb, then a?b
  • Constraint (2) ?i,j, if Qia and Qjb, then i-j
    ? a-b, and i-j ? b-a.

16
The N-queens problem
  • Alternative formalization of the N-queens problem
  • The set of variables Z Q1, Q2, , Q8
  • Domain DQ1 DQ2 DQ8 0,1,2,3,4, ,63
  • Constraints Ri is (Ni div 8)1, Ci is (Ni mod
    8)1Rj is (nj div 8)1, Cj is (Nj mod 8)1
  • Row (number div 8)1
  • Column (number mod 8)1
  • Ri ? Rj
  • Ci ? Cj
  • Ri-Rj ? Ci-Cj
  • Ri-Rj ? Cj-Ci
  • Formalization can be a hidden constraint.
  • The first one allows 88 combinations, the second
    one 648.
  • A problem can be formulated as a CSP in different
    ways.

17
The graph coloring problem
  • As a map can be represented by a graph where each
    node represents an area in the map, and every
    pair of nodes which represent two adjacent areas
    in the map is connected by an edge Figure 1.5.
  • Problem formalization
  • The set of variables Z w, x, y, z
  • Domain Dw Dx Dy Dz r, g, b
  • Constraints C Cw,x, Cw,y, Cx,y, Cx,z, Cy,z
  • Cx1,x2,,xn (Vx1?Vx2 ? ?Vxn)

18
(No Transcript)
19
The scene labeling problem
  • The task is to label all the edges in Figure 1.7,
    satisfying all the constraints.
  • The set of variables Z A, B, C, D, E, F, G,
    h, IOne way is to use one variable to represent
    the value of a line in the scene.
  • Domain D , -, ?, ?

20
(No Transcript)
21
(No Transcript)
22
Temporal reasoning
  • Events are all temporally related to each other.
    Depending on the structure of time one uses,
    different types of temporal relations apply.
  • In planning and scheduling, one has to determine
    the temporal relationship between events.
  • One approach is to pick up one temporal relation
    per pair of events in each step, and backtrack
    when the hypothetical situation has been proved
    to be unsatisiable.
  • The other approach is to reason with all
    disjunctive temporal relations simultaneously.

23
(No Transcript)
24
Resource allocation
  • Resource allocation, especially when time and
    shared resources are involved, is basically a
    CSP. Each variable in the CSP represents one
    shared resource requirement.
  • variable X may represent the machine requirement
    of a job (each variable in the CSP represents one
    shared resource requirement).
  • The domain may be the set of machines available
    in the workshop which have the capacity to do the
    job.
  • The allocation of resources is normally
    constrained in many ways.

25
Graph matching
  • Given two graphs G1 and G2, the problem is to
    check whether G2 has a subgraph which matches G1.
    Graph (V1, E1) contains graph (V2, E2) if(1)
    every node in V2 can be mapped to a distinct node
    in V1 and(2) for all x1, y1 in V1 and x2, y2
    in V2, if x2 and y2 are mapped to x1 and y1,
    respectively, then whenever (x2, y2) is an edge
    in E2, then (x1, y1) is an edge in E1.

26
(No Transcript)
27
Other application
  • The grammar of the language restricts the roles
    that a string of words can take simultaneously.
  • Database query optimization is an important
    database research area in which CSP solving
    techniques can be applied.
  • CSP techniques have also been applied to
    parameter setting for greenhouses in agricultural
    applications, and demonstrated to be successful.

28
Constraint programming
  • CLP one of the main objectives of developing
    CLP is to define a class of logic programming
    languages with well defined semantics under a
    particular equational theory.
  • Prolog III It was developed with similar goals
    as CLP, but with refined manipulation on trees
    (including infinite trees), lists and Boolean
    variables.
  • CHIP It is a logic programming language for
    handling symbolic, Boolean as well as numerical
    variables. The basic search strategy used in CHIP
    is called forward checking (FC). It is used
    together with a heuristic called the fail first
    principle (FFP). Its success has led to the of
    Charme and PECOS, which are mainly built to
    handle symbolic variables.
  • Charme It uses the syntax of C, and one of its
    merits is that it can easily be integrated into
    the users of the C programs.
  • PECOS It uses LISP syntax.
Write a Comment
User Comments (0)
About PowerShow.com