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
* Add plan for #422: [Model] TwoDimensionalConsecutiveSets
* Implement #422: [Model] TwoDimensionalConsecutiveSets
* chore: remove plan file after implementation
* fix: address PR #673 review comments
* fix: resolve remaining review findings for TwoDimensionalConsecutiveSets
* Fix example-db API: adapt to new ModelExampleSpec format
The ModelExampleSpec struct changed on main to use instance/optimal_config/optimal_value
fields instead of a build closure. Also update Typst paper to use new example-db format.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Separate validation from subset sorting in try_new
Split validation_error (which validated AND sorted) into a pure validate()
function and an explicit sorting step in try_new().
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Xiwei Pan <xiwei.pan@connect.hkust-gz.edu.cn>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Given finite alphabet $Sigma = {0, 1, dots, n - 1}$ and collection $cal(C) = {Sigma_1, dots, Sigma_m}$ of subsets of $Sigma$, determine whether $Sigma$ can be partitioned into disjoint sets $X_1, X_2, dots, X_k$ such that each $X_i$ has at most one element in common with each $Sigma_j$, and for each $Sigma_j incal(C)$ there is an index $l(j)$ with $Sigma_j subset.eq X_(l(j))union X_(l(j)+1)uniondots.cunion X_(l(j)+|Sigma_j|-1)$.
1926
+
][
1927
+
This problem generalizes the Consecutive Sets problem (SR18) by requiring not just that each subset's elements appear consecutively in an ordering, but that they be spread across consecutive groups of a partition where each group contributes at most one element per subset. Shown NP-complete by Lipski @lipski1977fct via transformation from Graph 3-Colorability. The problem arises in information storage and retrieval where records must be organized in contiguous blocks. It remains NP-complete if all subsets have at most 5 elements, but is solvable in polynomial time if all subsets have at most 2 elements. The brute-force algorithm assigns each of $n$ symbols to one of up to $n$ groups, giving $O^*(n^n)$ time#footnote[No algorithm improving on brute-force enumeration is known for this problem.].
1928
+
1929
+
*Example.* Let $Sigma = {0, 1, dots, #(n-1)}$ and $cal(C) = {#range(m).map(i=>$Sigma_#(i+1)$).join(", ")}$ with #subs.enumerate().map(((i, s)) =>$Sigma_#(i+1) = #fmt-set(s)$).join(", "). A valid partition uses $k = #k$ groups: #nonempty.map(((g, elems)) =>$X_#(g+1) = #fmt-set(elems)$).join(", "). Each group intersects every subset in at most one element, and each subset's elements span exactly $|Sigma_j|$ consecutive groups. For instance, $Sigma_1 = {0, 1, 2}$ maps to groups $X_1, X_2, X_3$ (consecutive), and $Sigma_5 = {0, 5}$ maps to groups $X_1, X_2$ (consecutive). Multiple valid partitions exist for this instance, differing only by unused or shifted group labels.
caption: [2-Dimensional Consecutive Sets: partition of $Sigma = {0, dots, 5}$ into #k groups satisfying intersection and consecutiveness constraints for all #m subsets.],
Copy file name to clipboardExpand all lines: docs/src/cli.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -502,6 +502,7 @@ Stdin is supported with `-`:
502
502
```bash
503
503
pred create MIS --graph 0-1,1-2,2-3 | pred solve -
504
504
pred create MIS --graph 0-1,1-2,2-3 | pred solve - --solver brute-force
505
+
pred create TwoDimensionalConsecutiveSets --alphabet-size 6 --sets "0,1,2;3,4,5;1,3;2,4;0,5" | pred solve - --solver brute-force
505
506
```
506
507
507
508
When the problem is not ILP, the solver automatically reduces it to ILP, solves, and maps the solution back. The auto-reduction is shown in the output:
0 commit comments