-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
146 lines (111 loc) · 3.9 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
##########################################################################
# #
# Combine - an OCaml library for combinatorics #
# #
# Copyright (C) 2012-2014 #
# Remy El Sibaie #
# Jean-Christophe Filliatre #
# #
# This software is free software; you can redistribute it and/or #
# modify it under the terms of the GNU Library General Public #
# License version 2.1, with the special exception on linking #
# described in file LICENSE. #
# #
# This software is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #
# #
##########################################################################
* Library
The Combine library contains four main modules:
- Dlx: implements Knuth's dancing links
- Zdd: implements Zero-suppressed binary decision diagrams
- Emc: a common interface to modules Dlx and Zdd to solve EMC +
reduction of EMC to SAT
- Tiling: converts a 2D tiling problem into an EMC problem
Usage: the Combine library is packed into a single module Combine, installed
in the subdirectory combine/ of OCaml's standard library. Thus, it must be
used as follows:
ocamlc -I +combine combine.cma <other files>
full documentation : https://www.lri.fr/~filliatr/combine/
* Examples
The distribution contains several example programs:
- queens.ml: solve the N-queens puzzle
- sudoku.ml: well, you haved guessed already
- color.ml: 4-color planar graphs using DLX and SAT (requires OCamlgraph
and an explicit 'make color.opt')
* Tiling language and interpreter
In addition to the library, Combine provides a language to describe 2D tiling
problems and an interpreter (combine) for this language.
Directory tests/ contains various examples of tiling problems (.cmb files).
To execute such a test, just run "combine" on the file.
The grammar of the tiling language is the following:
<file> ::= | decl ... decl
<decl> ::=
| pattern <identifier> = <expr>
| tiles <identifier> = <tile_list>
| problem <identifier> equal <expr> tl = tiles
| assert b = boolean_expr
| print <identifier>
| solve a = algo <identifier> out = output
| count a = algo <identifier>
| dimacs <identifier> <string>
| debug st = state
| timing st = state
| exit
| include <string>
algo ::=
| dlx
| zdd
| sat <string>
state ::=
| on
| off
option ::=
| one
| maybe
| sym
| rot
tiles ::=
| <tile_list>
| <identifier>
tile_list ::=
| [ tile, ..., tile ]
output ::=
| svg_out <string>
| ascii_out
isometry ::=
| id
| rot90
| rot180
| rot270
| vertrefl
| horizrefl
| diag1refl
| diag2refl
tile ::=
| <expr> o = list(option)
expr ::=
| lpar <expr> rpar
| <identifier>
| constant <dim> <bool>
| union <expr> <expr>
| inter <expr> <expr>
| diff <expr> <expr>
| xor <expr> <expr>
| <expr> minus <expr>
| <expr> ampamp <expr>
| <expr> barbar <expr>
| <expr> hat <expr>
| set <expr> <dim> <bool>
| crop <dim> <dim> <expr>
| shift <expr> <dim>
| resize <expr> <dim>
| apply <isometry> <expr>
| <ascii>
bool ::=
| false
| true
boolean_expr::=
| <bool>
| <expr> equal <expr>