A Table Representation


Index:

 Introduction 

 Syntax 

 Conditions 

 Examples 


 CPAI'2005 

Introduction

This document describes a table format for CSP specification.

Back to index ]

Syntax

The following specifies the syntax of the format.

<problem name>
<number of domain definitions> 
<domain definition number>     <domain size>     <domain values>
 .
 .
<number of variables>
<variable number>     <domain definition number>
.
.
<number of relation definitions>
<relation definition no.>    <type>    <arity>    <domain definition numbers>    <no. of tuples>    <tuples>
.
.
<number of constraints> 
<arity>    <variables involved>    <relation definition number>
.
.
 

Space (' ': ASCII CODE 32) and line feed ('\n': ASCII CODE 10) characters act as separators.

Back to index ]

Conditions

In addition it is assumed that the specification satisfies the following conditions.

  • The order of the values in a domain definition will obey the usual lexical ordering.
  • Values in the domains are numbered from -214–214.
  • Variables are numbered from 0–n-1, where n is the number of variables.
  • THIS RULE ADDED 07/07/05: In the section assigning the variables to their domains, variable i will be assigned its domain before variable j is assigned its domain if and only if i is less than j.
  • The number of relations for a given fixed scope is equal to one.
  • The order of the tuples in the relation definition will obey the usual lexicographical ordering.
  • The ith value of any tuple in a constraint or nogood constraint should be a member of the ith domain that that constraint or nogood constraint is defined on.
  • If the value of <type> is 0 then it means the tuples in the relation are conflicts. If it is 1 then it means all the tuples in the corresponding relation are supports.

Back to index ]

Examples

This section presents two small examples. The text in red describes the problem. Comments in black are inserted to make the example more understandable. However, in the proposed table format comments are not allowed.

Example: 4-queens problem

4queens
1                              /* Number of domain definitions */
0       4         1 2 3 4
4                               /* Number of variables */                     
0       0
1       0
2       0
3       0
3                           /* Number of relation definitions */
0       0      2      0  0            10        1 1   1 2   2 1   2 2   2 3   3 2   3 3   3 4   4 3   4 4
1       0      2      0  0              8        1 1   1 3   2 2   2 4   3 1   3 3   4 2   4 4
2       0      2      0  0              6        1 1   1 4   2 2   3 3   4 1   4 4
6                            /* Number of constraints */
2      0  1            0
2      0  2            1
2      0  3            2
2      1  2            0
2      1  3            1
2      2  3            0

  [Same example in xml format] 

Example: an instance involving non binary constraints

instance1
3                             /* Number of domain lists */
0        7        0 1 2 3 4 5 6
1        3        1 5 10
2      10        1 2 3 4 5 11 12 13 14 15
4                            /* Number of variables */                    
0        0
1        0
2        1
3        2
4                            /* Number of relation definitions */
0       0      2       0 0         7         0 0   1 1   2 2   2 2   3 3   4 4   5 5   6 6
1       0      2       0 2       25         1 0   1 1   1 2   1 3   1 4   1 5   1 6   2 1   2 2   2 3   2 4
                                                   2 5   2 6   3 2   3 3   3 4   3 5   3 6   4 3   4 4   4 5   4 6
                                                   5 4   5 5   5 6 
2       1      2       1 0         1         5 3
3       1      3       0 1 2    17         0   1  3    0 5   3    0 10 12   1   1  4   1   5   2   1 10 13 
                                                   2   1  5    2 5   1    2 10 14   3 10  5   3 10 15   4   5 11 
                                                   4 10  4    5 5 12    5 10   3   6   5 13  6 10   2 
4                           /* Number of constraints */
2       0 1             0 
2       0 3             1 
2       2 0             2
3       1 2 3          3
 
[Same example in xml format] 

Back to index ]