Skip to content

Commit db7bdf9

Browse files
committed
minor modifications
1 parent 6b117e9 commit db7bdf9

40 files changed

Lines changed: 60 additions & 123 deletions

File tree

_private/createjson.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def create_alternative_models(name, directory):
4444
start = False
4545
for line in lines:
4646
stripped = line.strip()
47-
if stripped.startswith("minimize(") or stripped.startswith("maximize("):
47+
if (stripped.startswith("minimize(") or stripped.startswith("maximize(")) and p not in ["Sudoku"]:
4848
type = "COP"
4949
if stripped.startswith("- http"):
5050
links.append(stripped[2:])

_private/models.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4898,7 +4898,7 @@
48984898
"Sum",
48994899
"Table"
49004900
],
4901-
"type": "COP",
4901+
"type": "CSP",
49024902
"tags": [
49034903
"recreational",
49044904
"notebook"
@@ -4956,7 +4956,7 @@
49564956
],
49574957
"links": [
49584958
"https://www.logisch-gedacht.de/logikraetsel/10stellige-zahl",
4959-
"https://en.wikipedia.org/wiki/Divisibility_rule)"
4959+
"https://en.wikipedia.org/wiki/Divisibility_rule"
49604960
]
49614961
},
49624962
{
@@ -5653,6 +5653,7 @@
56535653
"name": "Whirlpool",
56545654
"fullname": "academic/Whirlpool",
56555655
"constraints": [
5656+
"AllDifferent",
56565657
"Sum"
56575658
],
56585659
"type": "CSP",

academic/AllInterval/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ the problem of finding such a series is the all-interval series problem of order
2626

2727
## Model
2828
There are two variants:
29-
- a main variant;
30-
- a variant 'aux' involving auxiliary variables.
29+
- a main variant;
30+
- a variant 'aux' involving auxiliary variables.
3131

3232
You can also find a step-by-step modeling process in this [Jupyter notebook](http://pycsp.org/documentation/models/CSP/AllInterval/).
3333

academic/BIBD/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ It is a special case of Block Design, which also includes Latin Square problems.
88
BIBD generation is described in most standard textbooks on combinatorics.
99
A BIBD is defined as an arrangement of v distinct objects into b blocks such that each block contains exactly k distinct objects,
1010
each object occurs in exactly r different blocks, and every two distinct objects occur together in exactly l blocks.
11-
Another way of defining a BIBD is in terms of its incidence matrix, which is a v by b binary matrix with exactly r ones per row, k ones per column, and with a scalar product of l between any pair of distinct rows.
11+
Another way of defining a BIBD is in terms of its incidence matrix, which is a v by b binary matrix with exactly r ones per row, k ones per column,
12+
and with a scalar product of l between any pair of distinct rows.
1213
A BIBD is therefore specified by its parameters (v,b,r,k,l).
1314

1415
### Example

academic/Domino/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Informally the Domino problem is an undirected constraint graph with a cycle and
77
a pair (n,d), where n is the number of variables and d the size of the domain
88

99
## Model
10-
There are two variants: a main one and a variant 'table" with constraints in extension.
10+
There are two variants: a main one and a variant 'table' with constraints in extension.
1111

1212
constraints: [AllEqual](http://pycsp.org/documentation/constraints/AllEqual), [Table](http://pycsp.org/documentation/constraints/Table)
1313

academic/GolombRuler/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
This is [Problem 006](https://www.csplib.org/Problems/prob006/) at CSPLib.
44

5-
A Golomb ruler is defined as a set of n integers a1 < a2 < ... < an such that the n x (n-1)/2 differences aj - ai are distinct.
6-
Such a ruler is said to contain n marks (or ticks) and to be of length an.
5+
A Golomb ruler is defined as a set of n integers v1 < v2 < ... < vn such that the n x (n-1)/2 differences vj - vi are distinct.
6+
Such a ruler is said to contain n marks (or ticks) and to be of length vn.
77
The objective is to find optimal rulers (i.e., rulers of minimum length).
88

99
An optimal Golomb ruler with 4 ticks.
@@ -26,7 +26,7 @@ This problem (and its variants) is said to have many practical applications incl
2626

2727
Here, there are 3 variants:
2828
- a main one
29-
- a variant "dec" by decompoising the AllDifferent constraint
29+
- a variant "dec" by decomposing the AllDifferent constraint
3030
- a variant "aux" with auxiliary variables
3131

3232
constraints: [AllDifferent](http://pycsp.org/documentation/constraints/AllDifferent), [Maximum](http://pycsp.org/documentation/constraints/Maximum)

academic/Neighbours/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The original MZN model was proposed by Peter J. Stuckey, with a Licence that sem
1717
## Model
1818
There are two variants:
1919
- a main one with intensional constraints,
20-
- a 'table" variant with extensional constraints
20+
- a 'table' variant with extensional constraints
2121

2222
Constraints: Count, Lex, Sum, Table
2323

academic/Perfect1Factorization/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The MZN model was proposed by Mikael Zayenz Lagerkvist (Licence at https://githu
1515

1616
## Execution
1717
```
18-
python Perfect1Factorization.py -data=[number]
18+
python Perfect1Factorization.py -data=number
1919
```
2020

2121
## Links

academic/QuasiGroup/README.md

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This is [Problem 003](https://www.csplib.org/Problems/prob003/) at CSPLib.
44

55
An order n quasigroup is a Latin square of size n.
6-
That is, a n×n multiplication table in which each element occurs once in every row and column.
6+
That is, an n×n multiplication table in which each element occurs once in every row and column.
77
A quasigroup can be specified by a set and a binary multiplication operator, ∗ defined over this set.
88
Quasigroup existence problems determine the existence or non-existence of quasigroups of
99
a given size with additional properties. For example:
@@ -46,80 +46,6 @@ That is, a ∗ a = a for every element a.
4646

4747
## Tags
4848
academic, notebook, csplib, xcsp22
49-
"""
50-
51-
from pycsp3 import *
52-
53-
n = data or 8
54-
55-
pairs = [(i, j) for i in range(n) for j in range(n)]
56-
57-
# x[i][j] is the value at row i and column j of the quasi-group
58-
x = VarArray(size=[n, n], dom=range(n))
59-
60-
satisfy(
61-
# ensuring a Latin square
62-
AllDifferent(x, matrix=True),
63-
64-
# ensuring idempotence tag(idempotence)
65-
[x[i][i] == i for i in range(n)]
66-
)
67-
68-
if variant("base"):
69-
if subvariant("v3"):
70-
satisfy(
71-
x[x[i][j], x[j][i]] == i for i, j in pairs
72-
)
73-
elif subvariant("v4"):
74-
satisfy(
75-
x[x[j][i], x[i][j]] == i for i, j in pairs
76-
)
77-
elif subvariant("v5"):
78-
satisfy(
79-
x[x[x[j][i], j], j] == i for i, j in pairs
80-
)
81-
elif subvariant("v6"):
82-
satisfy(
83-
x[x[i][j], j] == x[i, x[i][j]] for i, j in pairs
84-
)
85-
elif subvariant("v7"):
86-
satisfy(
87-
x[x[j][i], j] == x[i, x[j][i]] for i, j in pairs
88-
)
89-
elif variant("aux"):
90-
if subvariant("v3"):
91-
y = VarArray(size=[n, n], dom=range(n * n))
92-
93-
satisfy(
94-
[x[y[i][j]] == i for i, j in pairs if i != j],
95-
[y[i][j] == x[i][j] * n + x[j][i] for i, j in pairs if i != j]
96-
)
97-
elif subvariant("v4"):
98-
y = VarArray(size=[n, n], dom=range(n * n))
99-
100-
satisfy(
101-
[x[y[i][j]] == i for i, j in pairs if i != j],
102-
[y[i][j] == x[j][i] * n + x[i][j] for i, j in pairs if i != j]
103-
)
104-
elif subvariant("v5"):
105-
y = VarArray(size=[n, n], dom=range(n))
106-
107-
satisfy(
108-
[x[:, i][x[i][j]] == y[i][j] for i, j in pairs if i != j],
109-
[x[:, i][y[i][j]] == j for i, j in pairs if i != j]
110-
)
111-
elif subvariant("v7"):
112-
y = VarArray(size=[n, n], dom=range(n))
113-
114-
satisfy(
115-
(
116-
x[:, j][x[j][i]] == y[i][j],
117-
x[i][x[j][i]] == y[i][j]
118-
) for i, j in pairs if i != j
119-
)
120-
121-
""" Comments
122-
1) note that we can post tuples of constraints instead of individually, as demonstrated in aux-v7
12349

12450
<br />
12551

academic/Queens/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is [Problem 054](https://www.csplib.org/Problems/prob054/) at CSPLib.
44

5-
Can n queens (of the same colour) be placed on a n×n chessboard so that none of the queens can attack each other?
5+
Can n queens (of the same colour) be placed on an n×n chessboard so that none of the queens can attack each other?
66

77
## Example
88
A solution for n=8

0 commit comments

Comments
 (0)