-
Notifications
You must be signed in to change notification settings - Fork 0
/
kakuro_simple.lp
152 lines (151 loc) · 8.6 KB
/
kakuro_simple.lp
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
\ Model kakuro
\ LP format - for model browsing. Use MPS format to capture full model detail.
Minimize
Subject To
Vertical_Sum_at_(0,3): G[1,3,0] + 2 G[1,3,1] + 3 G[1,3,2] + 4 G[1,3,3]
+ 5 G[1,3,4] + 6 G[1,3,5] + 7 G[1,3,6] + 8 G[1,3,7] + 9 G[1,3,8]
+ G[2,3,0] + 2 G[2,3,1] + 3 G[2,3,2] + 4 G[2,3,3] + 5 G[2,3,4]
+ 6 G[2,3,5] + 7 G[2,3,6] + 8 G[2,3,7] + 9 G[2,3,8] + G[3,3,0]
+ 2 G[3,3,1] + 3 G[3,3,2] + 4 G[3,3,3] + 5 G[3,3,4] + 6 G[3,3,5]
+ 7 G[3,3,6] + 8 G[3,3,7] + 9 G[3,3,8] = 13
ColUniqueness_at_(0,3): G[1,3,0] + G[2,3,0] + G[3,3,0] <= 1
ColUniqueness_at_(0,3): G[1,3,1] + G[2,3,1] + G[3,3,1] <= 1
ColUniqueness_at_(0,3): G[1,3,2] + G[2,3,2] + G[3,3,2] <= 1
ColUniqueness_at_(0,3): G[1,3,3] + G[2,3,3] + G[3,3,3] <= 1
ColUniqueness_at_(0,3): G[1,3,4] + G[2,3,4] + G[3,3,4] <= 1
ColUniqueness_at_(0,3): G[1,3,5] + G[2,3,5] + G[3,3,5] <= 1
ColUniqueness_at_(0,3): G[1,3,6] + G[2,3,6] + G[3,3,6] <= 1
ColUniqueness_at_(0,3): G[1,3,7] + G[2,3,7] + G[3,3,7] <= 1
ColUniqueness_at_(0,3): G[1,3,8] + G[2,3,8] + G[3,3,8] <= 1
Vertical_Sum_at_(0,4): G[1,4,0] + 2 G[1,4,1] + 3 G[1,4,2] + 4 G[1,4,3]
+ 5 G[1,4,4] + 6 G[1,4,5] + 7 G[1,4,6] + 8 G[1,4,7] + 9 G[1,4,8]
+ G[2,4,0] + 2 G[2,4,1] + 3 G[2,4,2] + 4 G[2,4,3] + 5 G[2,4,4]
+ 6 G[2,4,5] + 7 G[2,4,6] + 8 G[2,4,7] + 9 G[2,4,8] = 9
ColUniqueness_at_(0,4): G[1,4,0] + G[2,4,0] <= 1
ColUniqueness_at_(0,4): G[1,4,1] + G[2,4,1] <= 1
ColUniqueness_at_(0,4): G[1,4,2] + G[2,4,2] <= 1
ColUniqueness_at_(0,4): G[1,4,3] + G[2,4,3] <= 1
ColUniqueness_at_(0,4): G[1,4,4] + G[2,4,4] <= 1
ColUniqueness_at_(0,4): G[1,4,5] + G[2,4,5] <= 1
ColUniqueness_at_(0,4): G[1,4,6] + G[2,4,6] <= 1
ColUniqueness_at_(0,4): G[1,4,7] + G[2,4,7] <= 1
ColUniqueness_at_(0,4): G[1,4,8] + G[2,4,8] <= 1
Vertical_Sum_at_(1,2): G[2,2,0] + 2 G[2,2,1] + 3 G[2,2,2] + 4 G[2,2,3]
+ 5 G[2,2,4] + 6 G[2,2,5] + 7 G[2,2,6] + 8 G[2,2,7] + 9 G[2,2,8]
+ G[3,2,0] + 2 G[3,2,1] + 3 G[3,2,2] + 4 G[3,2,3] + 5 G[3,2,4]
+ 6 G[3,2,5] + 7 G[3,2,6] + 8 G[3,2,7] + 9 G[3,2,8] + G[4,2,0]
+ 2 G[4,2,1] + 3 G[4,2,2] + 4 G[4,2,3] + 5 G[4,2,4] + 6 G[4,2,5]
+ 7 G[4,2,6] + 8 G[4,2,7] + 9 G[4,2,8] = 13
ColUniqueness_at_(1,2): G[2,2,0] + G[3,2,0] + G[4,2,0] <= 1
ColUniqueness_at_(1,2): G[2,2,1] + G[3,2,1] + G[4,2,1] <= 1
ColUniqueness_at_(1,2): G[2,2,2] + G[3,2,2] + G[4,2,2] <= 1
ColUniqueness_at_(1,2): G[2,2,3] + G[3,2,3] + G[4,2,3] <= 1
ColUniqueness_at_(1,2): G[2,2,4] + G[3,2,4] + G[4,2,4] <= 1
ColUniqueness_at_(1,2): G[2,2,5] + G[3,2,5] + G[4,2,5] <= 1
ColUniqueness_at_(1,2): G[2,2,6] + G[3,2,6] + G[4,2,6] <= 1
ColUniqueness_at_(1,2): G[2,2,7] + G[3,2,7] + G[4,2,7] <= 1
ColUniqueness_at_(1,2): G[2,2,8] + G[3,2,8] + G[4,2,8] <= 1
RightSum_at_(1,2): G[1,3,0] + 2 G[1,3,1] + 3 G[1,3,2] + 4 G[1,3,3]
+ 5 G[1,3,4] + 6 G[1,3,5] + 7 G[1,3,6] + 8 G[1,3,7] + 9 G[1,3,8]
+ G[1,4,0] + 2 G[1,4,1] + 3 G[1,4,2] + 4 G[1,4,3] + 5 G[1,4,4]
+ 6 G[1,4,5] + 7 G[1,4,6] + 8 G[1,4,7] + 9 G[1,4,8] = 17
RowUniqueness_at_(1,2): G[1,3,0] + G[1,4,0] <= 1
RowUniqueness_at_(1,2): G[1,3,1] + G[1,4,1] <= 1
RowUniqueness_at_(1,2): G[1,3,2] + G[1,4,2] <= 1
RowUniqueness_at_(1,2): G[1,3,3] + G[1,4,3] <= 1
RowUniqueness_at_(1,2): G[1,3,4] + G[1,4,4] <= 1
RowUniqueness_at_(1,2): G[1,3,5] + G[1,4,5] <= 1
RowUniqueness_at_(1,2): G[1,3,6] + G[1,4,6] <= 1
RowUniqueness_at_(1,2): G[1,3,7] + G[1,4,7] <= 1
RowUniqueness_at_(1,2): G[1,3,8] + G[1,4,8] <= 1
MissingVal_at_(1,3): G[1,3,0] + G[1,3,1] + G[1,3,2] + G[1,3,3] + G[1,3,4]
+ G[1,3,5] + G[1,3,6] + G[1,3,7] + G[1,3,8] = 1
MissingVal_at_(1,4): G[1,4,0] + G[1,4,1] + G[1,4,2] + G[1,4,3] + G[1,4,4]
+ G[1,4,5] + G[1,4,6] + G[1,4,7] + G[1,4,8] = 1
Vertical_Sum_at_(2,1): G[3,1,0] + 2 G[3,1,1] + 3 G[3,1,2] + 4 G[3,1,3]
+ 5 G[3,1,4] + 6 G[3,1,5] + 7 G[3,1,6] + 8 G[3,1,7] + 9 G[3,1,8]
+ G[4,1,0] + 2 G[4,1,1] + 3 G[4,1,2] + 4 G[4,1,3] + 5 G[4,1,4]
+ 6 G[4,1,5] + 7 G[4,1,6] + 8 G[4,1,7] + 9 G[4,1,8] = 3
ColUniqueness_at_(2,1): G[3,1,0] + G[4,1,0] <= 1
ColUniqueness_at_(2,1): G[3,1,1] + G[4,1,1] <= 1
ColUniqueness_at_(2,1): G[3,1,2] + G[4,1,2] <= 1
ColUniqueness_at_(2,1): G[3,1,3] + G[4,1,3] <= 1
ColUniqueness_at_(2,1): G[3,1,4] + G[4,1,4] <= 1
ColUniqueness_at_(2,1): G[3,1,5] + G[4,1,5] <= 1
ColUniqueness_at_(2,1): G[3,1,6] + G[4,1,6] <= 1
ColUniqueness_at_(2,1): G[3,1,7] + G[4,1,7] <= 1
ColUniqueness_at_(2,1): G[3,1,8] + G[4,1,8] <= 1
RightSum_at_(2,1): G[2,2,0] + 2 G[2,2,1] + 3 G[2,2,2] + 4 G[2,2,3]
+ 5 G[2,2,4] + 6 G[2,2,5] + 7 G[2,2,6] + 8 G[2,2,7] + 9 G[2,2,8]
+ G[2,3,0] + 2 G[2,3,1] + 3 G[2,3,2] + 4 G[2,3,3] + 5 G[2,3,4]
+ 6 G[2,3,5] + 7 G[2,3,6] + 8 G[2,3,7] + 9 G[2,3,8] + G[2,4,0]
+ 2 G[2,4,1] + 3 G[2,4,2] + 4 G[2,4,3] + 5 G[2,4,4] + 6 G[2,4,5]
+ 7 G[2,4,6] + 8 G[2,4,7] + 9 G[2,4,8] = 10
RowUniqueness_at_(2,1): G[2,2,0] + G[2,3,0] + G[2,4,0] <= 1
RowUniqueness_at_(2,1): G[2,2,1] + G[2,3,1] + G[2,4,1] <= 1
RowUniqueness_at_(2,1): G[2,2,2] + G[2,3,2] + G[2,4,2] <= 1
RowUniqueness_at_(2,1): G[2,2,3] + G[2,3,3] + G[2,4,3] <= 1
RowUniqueness_at_(2,1): G[2,2,4] + G[2,3,4] + G[2,4,4] <= 1
RowUniqueness_at_(2,1): G[2,2,5] + G[2,3,5] + G[2,4,5] <= 1
RowUniqueness_at_(2,1): G[2,2,6] + G[2,3,6] + G[2,4,6] <= 1
RowUniqueness_at_(2,1): G[2,2,7] + G[2,3,7] + G[2,4,7] <= 1
RowUniqueness_at_(2,1): G[2,2,8] + G[2,3,8] + G[2,4,8] <= 1
MissingVal_at_(2,2): G[2,2,0] + G[2,2,1] + G[2,2,2] + G[2,2,3] + G[2,2,4]
+ G[2,2,5] + G[2,2,6] + G[2,2,7] + G[2,2,8] = 1
MissingVal_at_(2,3): G[2,3,0] + G[2,3,1] + G[2,3,2] + G[2,3,3] + G[2,3,4]
+ G[2,3,5] + G[2,3,6] + G[2,3,7] + G[2,3,8] = 1
MissingVal_at_(2,4): G[2,4,0] + G[2,4,1] + G[2,4,2] + G[2,4,3] + G[2,4,4]
+ G[2,4,5] + G[2,4,6] + G[2,4,7] + G[2,4,8] = 1
RightSum_at_(3,0): G[3,1,0] + 2 G[3,1,1] + 3 G[3,1,2] + 4 G[3,1,3]
+ 5 G[3,1,4] + 6 G[3,1,5] + 7 G[3,1,6] + 8 G[3,1,7] + 9 G[3,1,8]
+ G[3,2,0] + 2 G[3,2,1] + 3 G[3,2,2] + 4 G[3,2,3] + 5 G[3,2,4]
+ 6 G[3,2,5] + 7 G[3,2,6] + 8 G[3,2,7] + 9 G[3,2,8] + G[3,3,0]
+ 2 G[3,3,1] + 3 G[3,3,2] + 4 G[3,3,3] + 5 G[3,3,4] + 6 G[3,3,5]
+ 7 G[3,3,6] + 8 G[3,3,7] + 9 G[3,3,8] = 7
RowUniqueness_at_(3,0): G[3,1,0] + G[3,2,0] + G[3,3,0] <= 1
RowUniqueness_at_(3,0): G[3,1,1] + G[3,2,1] + G[3,3,1] <= 1
RowUniqueness_at_(3,0): G[3,1,2] + G[3,2,2] + G[3,3,2] <= 1
RowUniqueness_at_(3,0): G[3,1,3] + G[3,2,3] + G[3,3,3] <= 1
RowUniqueness_at_(3,0): G[3,1,4] + G[3,2,4] + G[3,3,4] <= 1
RowUniqueness_at_(3,0): G[3,1,5] + G[3,2,5] + G[3,3,5] <= 1
RowUniqueness_at_(3,0): G[3,1,6] + G[3,2,6] + G[3,3,6] <= 1
RowUniqueness_at_(3,0): G[3,1,7] + G[3,2,7] + G[3,3,7] <= 1
RowUniqueness_at_(3,0): G[3,1,8] + G[3,2,8] + G[3,3,8] <= 1
MissingVal_at_(3,1): G[3,1,0] + G[3,1,1] + G[3,1,2] + G[3,1,3] + G[3,1,4]
+ G[3,1,5] + G[3,1,6] + G[3,1,7] + G[3,1,8] = 1
MissingVal_at_(3,2): G[3,2,0] + G[3,2,1] + G[3,2,2] + G[3,2,3] + G[3,2,4]
+ G[3,2,5] + G[3,2,6] + G[3,2,7] + G[3,2,8] = 1
MissingVal_at_(3,3): G[3,3,0] + G[3,3,1] + G[3,3,2] + G[3,3,3] + G[3,3,4]
+ G[3,3,5] + G[3,3,6] + G[3,3,7] + G[3,3,8] = 1
RightSum_at_(4,0): G[4,1,0] + 2 G[4,1,1] + 3 G[4,1,2] + 4 G[4,1,3]
+ 5 G[4,1,4] + 6 G[4,1,5] + 7 G[4,1,6] + 8 G[4,1,7] + 9 G[4,1,8]
+ G[4,2,0] + 2 G[4,2,1] + 3 G[4,2,2] + 4 G[4,2,3] + 5 G[4,2,4]
+ 6 G[4,2,5] + 7 G[4,2,6] + 8 G[4,2,7] + 9 G[4,2,8] = 4
RowUniqueness_at_(4,0): G[4,1,0] + G[4,2,0] <= 1
RowUniqueness_at_(4,0): G[4,1,1] + G[4,2,1] <= 1
RowUniqueness_at_(4,0): G[4,1,2] + G[4,2,2] <= 1
RowUniqueness_at_(4,0): G[4,1,3] + G[4,2,3] <= 1
RowUniqueness_at_(4,0): G[4,1,4] + G[4,2,4] <= 1
RowUniqueness_at_(4,0): G[4,1,5] + G[4,2,5] <= 1
RowUniqueness_at_(4,0): G[4,1,6] + G[4,2,6] <= 1
RowUniqueness_at_(4,0): G[4,1,7] + G[4,2,7] <= 1
RowUniqueness_at_(4,0): G[4,1,8] + G[4,2,8] <= 1
MissingVal_at_(4,1): G[4,1,0] + G[4,1,1] + G[4,1,2] + G[4,1,3] + G[4,1,4]
+ G[4,1,5] + G[4,1,6] + G[4,1,7] + G[4,1,8] = 1
MissingVal_at_(4,2): G[4,2,0] + G[4,2,1] + G[4,2,2] + G[4,2,3] + G[4,2,4]
+ G[4,2,5] + G[4,2,6] + G[4,2,7] + G[4,2,8] = 1
Bounds
Binaries
G[1,3,0] G[1,3,1] G[1,3,2] G[1,3,3] G[1,3,4] G[1,3,5] G[1,3,6] G[1,3,7]
G[1,3,8] G[1,4,0] G[1,4,1] G[1,4,2] G[1,4,3] G[1,4,4] G[1,4,5] G[1,4,6]
G[1,4,7] G[1,4,8] G[2,2,0] G[2,2,1] G[2,2,2] G[2,2,3] G[2,2,4] G[2,2,5]
G[2,2,6] G[2,2,7] G[2,2,8] G[2,3,0] G[2,3,1] G[2,3,2] G[2,3,3] G[2,3,4]
G[2,3,5] G[2,3,6] G[2,3,7] G[2,3,8] G[2,4,0] G[2,4,1] G[2,4,2] G[2,4,3]
G[2,4,4] G[2,4,5] G[2,4,6] G[2,4,7] G[2,4,8] G[3,1,0] G[3,1,1] G[3,1,2]
G[3,1,3] G[3,1,4] G[3,1,5] G[3,1,6] G[3,1,7] G[3,1,8] G[3,2,0] G[3,2,1]
G[3,2,2] G[3,2,3] G[3,2,4] G[3,2,5] G[3,2,6] G[3,2,7] G[3,2,8] G[3,3,0]
G[3,3,1] G[3,3,2] G[3,3,3] G[3,3,4] G[3,3,5] G[3,3,6] G[3,3,7] G[3,3,8]
G[4,1,0] G[4,1,1] G[4,1,2] G[4,1,3] G[4,1,4] G[4,1,5] G[4,1,6] G[4,1,7]
G[4,1,8] G[4,2,0] G[4,2,1] G[4,2,2] G[4,2,3] G[4,2,4] G[4,2,5] G[4,2,6]
G[4,2,7] G[4,2,8]
End