You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Model the Golomb problem of `n` marks on the ruler `0:L`. The `modeler` argument accepts :raw, and :JuMP (default), which refer respectively to the solver internal model, the MathOptInterface model, and the JuMP model.
functionSudokuInstance(A::AbstractMatrix{T}) where {T<:Integer}
142
+
functionSudokuInstance(A::AbstractMatrix{T}) where {T<:Integer}
145
143
size(A, 1) ==size(A, 2) ||throw(error("Sodokus must be square; received matrix of size $(size(A, 1))×$(size(A, 2))."))
146
144
isequal(sqrt(size(A, 1)), isqrt(size(A, 1))) ||throw(error("SudokuInstances must be able to split into equal boxes (e.g., a 9×9 SudokuInstance has three 3×3 squares). Size given is $(size(A, 1))×$(size(A, 2))."))
147
145
new{T}(A)
@@ -172,8 +170,8 @@ Construct a `SudokuInstance` with the values `X` of a solver as input.
172
170
functionSudokuInstance(X::Dictionary)
173
171
n =isqrt(length(X))
174
172
A =zeros(Int, n, n)
175
-
for (k,v) inenumerate(Base.Iterators.partition(X, n))
176
-
A[k,:] = v
173
+
for (k,v) inenumerate(Base.Iterators.partition(X, n))
174
+
A[k,:] = v
177
175
end
178
176
returnSudokuInstance(A)
179
177
end
@@ -238,7 +236,7 @@ function _format_line_segment(r, col_pos, M)
238
236
line =string()
239
237
for k inaxes(r, 1)
240
238
n_spaces =1
241
-
Δ =maximum((ndigits(i) for i in M[:, (col_pos*sep_length)+k])) -ndigits(r[k])
239
+
Δ =maximum((ndigits(i) for i in M[:, (col_pos*sep_length)+k])) -ndigits(r[k])
242
240
if Δ ≥0
243
241
n_spaces = Δ +1
244
242
end
@@ -259,7 +257,7 @@ function _format_line(r, M)
259
257
line = _rules[:column]
260
258
for i in1:sep_length
261
259
abs_sep_pos = sep_length * i
262
-
line *=_format_line_segment(r[(abs_sep_pos-sep_length+1):abs_sep_pos], i -1, M)
260
+
line *=_format_line_segment(r[(abs_sep_pos-sep_length+1):abs_sep_pos], i -1, M)
0 commit comments