###############################################################################
#
# CIS*4750 Course Project: Format of the csp definition file
#
# Author: Daniel F. Dickinson <danielfdickinson@yahoo.ca>
#
# Copyright 2002-2003 University of Guelph, All Rights Reserved
#
###############################################################################

First line consists of the character Z or S (Zebra or Sherlock)

Each subsequent line contains a relation that defines a constraint, is a
comment line, or is a blank line.  Comment lines have a hash mark (#) as the 
first character on the line.

For the Zebra problem a file called zebra-unique which contains the uniqueness 
constraints (each house a different colour, a favourite brand of cigarette, 
etc) can be found in the templates directory.  A file for the Sherlock 
problem called sherlock-unique can also be found in that directory.

The available relations for the Zebra-like problems are (where v1 represents 
the first variable and v2 represents the second variable in the constraint, 
and value is the column the variable appears in).

v1 not-equal v2
v1 same-col v2
v1 right-of v2
v1 next-to v2
v1 is value			(v1 is set to a known value from its domain)

The variables representing the Zebra problem are as follows:

Houses
v[01]:  Red 			(R)
v[02]:  Blue			(B)
v[03]:  Yellow			(Y)
v[04]:  Green			(G)
v[05]:  Ivory			(I)
Cigarettes
v[06]:  Old-Gold		(G)
v[07]:  Parliament		(P)
v[08]:  Kools			(K)
v[09]:  Lucky			(L)
v[10]:  Chesterfield		(C)
Nationalities
v[11]: Norwegian		(N)
v[12]: Ukranian			(U)
v[13]: Englishman		(E)
v[14]: Spaniard			(S)
v[15]: Japanese			(J)
Pets
v[16]: Zebra			(Z)
v[17]: Dog			(D)
v[18]: Horse			(H)
v[19]: Fox			(F)
v[20]: Snails			{S}
Drinks
v[21]: Coffee			(C)
v[22]: Tea			(T)
v[23]: Water			(W)
v[24]: Milk			(M)
v[25]: Orange Juice		(O)

Each variable has a domain of {1, 2, 3, 4, 5} where the value represents
the column the variable appears in.

The classic Zebra problem, as described in [Prosser93] (see report), uses the 
above variables with the following constraints:

#[sample Zebra problem file]
Z
# The classic Zebra problem
# Each house is of different colour
01 not-equal 02
01 not-equal 03
01 not-equal 04
01 not-equal 05
02 not-equal 01
02 not-equal 03
02 not-equal 04
02 not-equal 05
03 not-equal 01
03 not-equal 02
03 not-equal 04
03 not-equal 05
04 not-equal 01
04 not-equal 02
04 not-equal 03
04 not-equal 05
05 not-equal 01
05 not-equal 02
05 not-equal 03
05 not-equal 04
# Inhabited by a single person
11 not-equal 12
11 not-equal 13
11 not-equal 14
11 not-equal 15
12 not-equal 11
12 not-equal 13
12 not-equal 14
12 not-equal 15
13 not-equal 11
13 not-equal 12
13 not-equal 14
13 not-equal 15
14 not-equal 11
14 not-equal 12
14 not-equal 13
14 not-equal 15
15 not-equal 11
15 not-equal 12
15 not-equal 13
15 not-equal 14
# Who smokes a unique brand of cigarettes
06 not-equal 07
06 not-equal 08
06 not-equal 09
06 not-equal 10
07 not-equal 06
07 not-equal 08
07 not-equal 09
07 not-equal 10
08 not-equal 06
08 not-equal 07
08 not-equal 09
08 not-equal 10
09 not-equal 06
09 not-equal 07
09 not-equal 08
09 not-equal 10
10 not-equal 06
10 not-equal 07
10 not-equal 08
10 not-equal 09
# Owns a pet
16 not-equal 17
16 not-equal 18
16 not-equal 19
16 not-equal 20
17 not-equal 16
17 not-equal 18
17 not-equal 19
17 not-equal 20
18 not-equal 16
18 not-equal 17
18 not-equal 19
18 not-equal 20
19 not-equal 16
19 not-equal 17
19 not-equal 18
19 not-equal 20
20 not-equal 16
20 not-equal 17
20 not-equal 18
20 not-equal 19
# Has a preferred drink
21 not-equal 12
21 not-equal 13
21 not-equal 14
21 not-equal 15
22 not-equal 11
22 not-equal 13
22 not-equal 14
22 not-equal 15
23 not-equal 11
23 not-equal 12
23 not-equal 14
23 not-equal 15
24 not-equal 11
24 not-equal 12
24 not-equal 13
24 not-equal 15
25 not-equal 11
25 not-equal 12
25 not-equal 13
25 not-equal 14
# The Englishman lives in a Red house
13 same-col 01
01 same-col 13
# The Spaniard owns a Dog
14 same-col 17
17 same-col 14
# Coffee is drunk in the Green house
21 same-col 04
04 same-col 21
# The Ukranian drinks Tea
12 same-col 22
22 same-col 12
# The Green house is the the immediate right of the Ivory house
04 next-right 05
05 next-left 04
# The Old-Gold smoker owns Snails
06 same-col 20
20 same-col 06
# Kools are smoked in the Yellow house
08 same-col 03
03 same-col 08
# Milk is drunk in the middle house
24 given 3
# The Norwegian lives in the first house on the left
11 given 1
# The Chesterfield smoker lives next to the Fox owner
10 next-to 19
19 next-to 10
# Kools are smoked in the house next to the house where the Horse is kept
08 next-to 18
18 next-to 08
# The Lucky smoker drinks Orange Juice 
09 same-col 25
25 same-col 09
# The Japanese smokes Parliament
15 same-col 07
07 same-col 15
# The Norwegian lives next to the Blue house
11 next-to 02
02 next-to 11
#[end of sample Zebra problem file]

The variables for the Sherlock problem are as follows:

Houses
v[01]:  Red 				(R)
v[02]:  Blue				(B)
v[03]:  Yellow				(Y)
v[04]:  Green				(G)
v[05]:  White				(W)
v[06]:  Brown				(N)
People
v[07]: Norwegian			(N)
v[08]: Ukranian				(U)
v[09]  Englishman			(E)
v[10]: Spaniard				(S)
v[11]: Japanese				(J)
v[12]: African				(A)
Numbers
v[13]: 1				(1)
v[14]: 2				(2)
v[15]: 3				(3)
v[16]: 4				(4)
v[17]: 5				(5)
v[18]: 6				(6)
Fruit
v[19]: Pear				(P)
v[20]: Orange				(O)
v[21]: Apple				(A)
v[22]: Banana				(B)
v[23]: Cherry				(C)
v[24]: Strawberry			(S)
Street Signs
v[25]: Stop sign			(S)
v[26]: Hospital sign			(H)
v[27]: Speed Limit			(P)
v[28]: One Way				(O) 
v[29]: Railroad Crossing		(R)
v[30]: Dead End				(D)
Letters
v[31]: H				(H)
v[32]: O	                    	(O)
v[33]: L				(L)
v[34]: M				(M)
v[35]: E				(E)
v[36]: S				(S)

Each variable in the Sherlock problem has a domain of {1, 2, 3, 4, 5, 6} which
represents the column the variable can appear in.

The constraints for the Sherlock problem are as follows:

v1 not-equal v2
v1 same-col v2
v1 not-same-col v2
v1 next-to v2
v1 not-next-to v2
v1 right-of v2
v1 left-of v2
v1 is value		(v1 is set to a known value from its domain)

A sample Sherlock problem is defined below:

#[sample sherlock problem]
S
2 is 1
9 is 1
11 is 2
17 is 2
20 is 3
21 is 2
22 is 4
24 is 5
27 is 6
28 is 5
1 not-next-same 2
1 not-equal 2
1 not-equal 3
1 not-equal 4
1 not-equal 5
1 not-equal 6
1 not-next-to 14
1 not-same-col 26
1 same-col 33
2 not-next-same 1
2 not-equal 1
2 not-equal 3
2 not-equal 4
2 not-equal 5
2 not-equal 6
2 left-of 13
2 left-of 25
2 not-next-to 35
3 not-equal 1
3 not-equal 2
3 left-of 4
3 not-equal 4
3 not-equal 5
3 not-equal 6
3 next-right 30
3 not-next-same 36
4 not-equal 1
4 not-equal 2
4 right-of 3
4 not-equal 3
4 not-equal 5
4 not-equal 6
4 not-same-col 19
4 not-same-col 20
4 not-next-to 25
4 right-of 30
5 not-equal 1
5 not-equal 2
5 not-equal 3
5 not-equal 4
5 not-equal 6
5 not-same-col 14
5 not-next-same 25
5 not-same-col 33
5 next-to 34
6 not-equal 1
6 not-equal 2
6 not-equal 3
6 not-equal 4
6 not-equal 5
6 not-next-to 17
6 not-next-to 24
6 not-same-col 29
7 not-equal 8
7 not-equal 9
7 not-equal 10
7 not-equal 11
7 not-equal 12
7 not-next-to 15
7 left-of 22
7 left-of 28
7 left-of 35
8 not-equal 7
8 not-equal 9
8 not-equal 10
8 not-equal 11
8 not-equal 12
8 not-same-col 17
8 not-next-same 22
8 not-same-col 33
9 not-equal 7
9 not-equal 8
9 not-equal 10
9 not-equal 11
9 not-equal 12
9 not-same-col 21
10 not-equal 7
10 not-equal 8
10 not-equal 9
10 not-equal 11
10 not-equal 12
10 not-same-col 32
10 not-next-to 34
10 same-col 34
11 not-equal 7
11 not-equal 8
11 not-equal 9
11 not-equal 10
11 not-equal 12
11 not-next-same 15
11 next-to 33
12 not-equal 7
12 not-equal 8
12 not-equal 9
12 not-equal 10
12 not-equal 11
12 next-right 16
12 not-same-col 23
13 right-of 2
13 next-left 14
13 not-equal 14
13 not-equal 15
13 not-equal 16
13 not-equal 17
13 not-equal 18
13 not-next-same 25
13 not-same-col 30
13 not-next-to 31
13 not-next-to 36
14 not-next-to 1
14 not-same-col 5
14 next-right 13
14 not-equal 13
14 not-equal 15
14 not-equal 16
14 not-equal 17
14 not-equal 18
15 not-next-to 7
15 not-next-same 11
15 not-equal 13
15 not-equal 14
15 not-equal 16
15 not-equal 17
15 not-equal 18
15 not-next-same 20
15 right-of 25
15 not-same-col 36
16 next-left 12
16 not-equal 13
16 not-equal 14
16 not-equal 15
16 not-equal 17
16 not-equal 18
16 not-same-col 31
16 not-next-same 34
16 next-to 35
16 next-left 35
17 not-next-to 6
17 not-same-col 8
17 not-equal 13
17 not-equal 14
17 not-equal 15
17 not-equal 16
17 not-equal 18
17 not-next-to 21
17 not-same-col 24
17 not-next-same 26
18 not-equal 13
18 not-equal 14
18 not-equal 15
18 not-equal 16
18 not-equal 17
18 next-left 21
18 not-next-same 22
19 not-same-col 4
19 right-of 20
19 not-next-same 20
19 not-equal 20
19 not-equal 21
19 not-equal 22
19 not-equal 23
19 not-equal 24
19 not-same-col 29
20 not-same-col 4
20 not-next-same 15
20 left-of 19
20 not-next-same 19
20 not-equal 19
20 not-equal 21
20 not-equal 22
20 not-next-same 23
20 not-equal 23
20 left-of 24
20 not-equal 24
20 not-next-same 32
20 not-next-to 36
21 not-same-col 9
21 not-next-to 17
21 next-right 18
21 not-equal 19
21 not-equal 20
21 not-equal 22
21 not-equal 23
21 not-equal 24
21 not-next-to 27
22 right-of 7
22 not-next-same 8
22 not-next-same 18
22 not-equal 19
22 not-equal 20
22 not-equal 21
22 not-equal 23
22 not-equal 24
22 not-next-same 27
23 not-same-col 12
23 not-equal 19
23 not-next-same 20
23 not-equal 20
23 not-equal 21
23 not-equal 22
23 not-equal 24
23 not-next-same 33
24 not-next-to 6
24 not-same-col 17
24 not-equal 19
24 right-of 20
24 not-equal 20
24 not-equal 21
24 not-equal 22
24 not-equal 23
24 not-same-col 29
25 right-of 2
25 not-next-to 4
25 not-next-same 5
25 not-next-same 13
25 left-of 15
25 not-equal 26
25 not-equal 27
25 not-equal 28
25 not-equal 29
25 not-equal 30
25 not-next-to 31
26 not-same-col 1
26 not-next-same 17
26 not-equal 25
26 not-equal 27
26 not-equal 28
26 not-equal 29
26 not-equal 30
26 next-to 33
27 not-next-to 21
27 not-next-same 22
27 not-equal 25
27 not-equal 26
27 not-equal 28
27 not-equal 29
27 not-equal 30
28 right-of 7
28 not-equal 25
28 not-equal 26
28 not-equal 27
28 not-equal 29
28 not-equal 30
28 same-col 34
29 not-same-col 6
29 not-same-col 19
29 not-same-col 24
29 not-equal 25
29 not-equal 26
29 not-equal 27
29 not-equal 28
29 not-equal 30
30 next-left 3
30 left-of 4
30 not-same-col 13
30 not-equal 25
30 not-equal 26
30 not-equal 27
30 not-equal 28
30 not-equal 29
30 left-of 35
31 not-next-to 13
31 not-same-col 16
31 not-next-to 25
31 not-equal 32
31 not-equal 33
31 not-equal 34
31 not-equal 35
31 not-equal 36
32 not-same-col 10
32 not-next-same 20
32 not-equal 31
32 not-equal 33
32 not-equal 34
32 not-equal 35
32 not-equal 36
33 same-col 1
33 not-same-col 5
33 not-same-col 8
33 next-to 11
33 not-next-same 23
33 next-to 26
33 not-equal 31
33 not-equal 32
33 not-equal 34
33 not-equal 35
33 not-equal 36
34 next-to 5
34 not-next-to 10
34 same-col 10
34 not-next-same 16
34 same-col 28
34 not-equal 31
34 not-equal 32
34 not-equal 33
34 not-equal 35
34 not-equal 36
35 not-next-to 2
35 right-of 7
35 next-to 16
35 next-right 16
35 right-of 30
35 not-equal 31
35 not-equal 32
35 not-equal 33
35 not-equal 34
35 not-same-col 36
35 not-next-same 36
35 not-equal 36
36 not-next-same 3
36 not-next-to 13
36 not-same-col 15
36 not-next-to 20
36 not-equal 31
36 not-equal 32
36 not-equal 33
36 not-equal 34
36 not-same-col 35
36 not-next-same 35
36 not-equal 35
#[end of sample Sherlock problem]
