-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcli.rs
More file actions
1541 lines (1456 loc) · 68.9 KB
/
cli.rs
File metadata and controls
1541 lines (1456 loc) · 68.9 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
use clap::{CommandFactory, Parser, Subcommand, ValueEnum};
use std::collections::HashMap;
use std::path::PathBuf;
#[derive(Parser)]
#[command(
name = "pred",
about = "Explore NP-hard problem reductions",
version,
after_help = "\
Typical workflow:
pred create MIS --graph 0-1,1-2,2-3 -o problem.json
pred solve problem.json
pred evaluate problem.json --config 1,0,1,0
Piping (use - to read from stdin):
pred create MIS --graph 0-1,1-2 | pred solve - # when an ILP reduction path exists
pred create StringToStringCorrection --source-string \"0,1,2,3,1,0\" --target-string \"0,1,3,2,1\" --bound 2 | pred solve - --solver brute-force
pred create MIS --graph 0-1,1-2 | pred evaluate - --config 1,0,1
pred create MIS --graph 0-1,1-2 | pred reduce - --to QUBO
JSON output (any command):
pred list --json # JSON to stdout
pred show MIS --json | jq '.' # pipe to jq
Use `pred <command> --help` for detailed usage of each command.
Use `pred list` to see all available problem types.
Enable tab completion:
eval \"$(pred completions)\" # add to ~/.bashrc or ~/.zshrc"
)]
pub struct Cli {
/// Output file path (implies JSON output)
#[arg(long, short, global = true)]
pub output: Option<PathBuf>,
/// Suppress informational messages on stderr
#[arg(long, short, global = true)]
pub quiet: bool,
/// Output JSON to stdout instead of human-readable text
#[arg(long, global = true)]
pub json: bool,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
/// List all registered problem types (or reduction rules with --rules)
#[command(after_help = "\
Examples:
pred list # list problem types
pred list --rules # list all reduction rules
pred list -o problems.json # save as JSON")]
List {
/// List reduction rules instead of problem types
#[arg(long)]
rules: bool,
},
/// Show details for a problem type or variant (fields, reductions, complexity)
#[command(after_help = "\
Examples:
pred show MIS # all variants for MIS
pred show MIS/UnitDiskGraph # specific variant
pred show MIS/UnitDiskGraph/i32 # fully qualified variant
pred show KSAT/K3 # KSatisfiability with K=3
Use `pred list` to see all available problem types and variants.")]
Show {
/// Problem name or variant (e.g., MIS, MIS/UnitDiskGraph, KSAT/K3)
#[arg(value_parser = crate::problem_name::ProblemNameParser)]
problem: String,
},
/// Explore problems that reduce TO this one (incoming neighbors)
#[command(after_help = "\
Examples:
pred to MIS # what reduces to MIS? (1 hop)
pred to MIS --hops 2 # 2-hop incoming neighbors
pred to MIS -o out.json # save as JSON
Use `pred from <problem>` for outgoing neighbors (what this reduces to).")]
To {
/// Problem name or alias (e.g., MIS, QUBO, MIS/UnitDiskGraph)
#[arg(value_parser = crate::problem_name::ProblemNameParser)]
problem: String,
/// Number of hops to explore
#[arg(long, default_value = "1")]
hops: usize,
},
/// Explore problems this reduces to, starting FROM it (outgoing neighbors)
#[command(after_help = "\
Examples:
pred from MIS # what does MIS reduce to? (1 hop)
pred from MIS --hops 2 # 2-hop outgoing neighbors
pred from MIS -o out.json # save as JSON
Use `pred to <problem>` for incoming neighbors (what reduces to this).")]
From {
/// Problem name or alias (e.g., MIS, QUBO, MIS/UnitDiskGraph)
#[arg(value_parser = crate::problem_name::ProblemNameParser)]
problem: String,
/// Number of hops to explore
#[arg(long, default_value = "1")]
hops: usize,
},
/// Find the cheapest reduction path between two problems
#[command(after_help = "\
Examples:
pred path MIS QUBO # cheapest path
pred path MIS QUBO --all # all paths
pred path MIS QUBO -o path.json # save for `pred reduce --via`
pred path MIS QUBO --all -o paths/ # save all paths to a folder
pred path MIS QUBO --cost minimize:num_variables
Use `pred list` to see available problems.")]
Path {
/// Source problem (e.g., MIS, MIS/UnitDiskGraph)
#[arg(value_parser = crate::problem_name::ProblemNameParser)]
source: String,
/// Target problem (e.g., QUBO)
#[arg(value_parser = crate::problem_name::ProblemNameParser)]
target: String,
/// Cost function [default: minimize-steps]
#[arg(long, default_value = "minimize-steps")]
cost: String,
/// Show all paths instead of just the cheapest
#[arg(long)]
all: bool,
/// Maximum paths to return in --all mode
#[arg(long, default_value_t = 20)]
max_paths: usize,
},
/// Export the reduction graph to JSON
#[command(after_help = "\
Examples:
pred export-graph # print to stdout
pred export-graph -o reduction_graph.json # save to file")]
ExportGraph,
/// Create a problem instance and save as JSON
Create(Box<CreateArgs>),
/// Evaluate a configuration against a problem instance JSON file
Evaluate(EvaluateArgs),
/// Reduce a problem instance to a target type
Reduce(ReduceArgs),
/// Inspect a problem JSON or reduction bundle
#[command(after_help = "\
Examples:
pred inspect problem.json
pred inspect bundle.json
pred create MIS --graph 0-1,1-2 | pred inspect -")]
Inspect(InspectArgs),
/// Solve a problem instance
Solve(SolveArgs),
/// Start MCP (Model Context Protocol) server for AI assistant integration
#[cfg(feature = "mcp")]
#[command(after_help = "\
Start a stdio-based MCP server that exposes problem reduction tools
to any MCP-compatible AI assistant.
Configuration:
Claude Code / Claude Desktop (.mcp.json or ~/.claude/mcp.json):
{ \"mcpServers\": { \"problemreductions\": {
\"command\": \"pred\", \"args\": [\"mcp\"] } } }
Cursor (.cursor/mcp.json):
{ \"mcpServers\": { \"problemreductions\": {
\"command\": \"pred\", \"args\": [\"mcp\"] } } }
Windsurf (~/.codeium/windsurf/mcp_config.json):
{ \"mcpServers\": { \"problemreductions\": {
\"command\": \"pred\", \"args\": [\"mcp\"] } } }
OpenCode (opencode.json):
{ \"mcp\": { \"problemreductions\": {
\"type\": \"local\", \"command\": [\"pred\", \"mcp\"] } } }
Test with MCP Inspector:
npx @modelcontextprotocol/inspector pred mcp")]
Mcp,
/// Print shell completions to stdout (auto-detects shell)
#[command(after_help = "\
Setup: add one line to your shell rc file:
# bash (~/.bashrc)
eval \"$(pred completions bash)\"
# zsh (~/.zshrc)
eval \"$(pred completions zsh)\"
# fish (~/.config/fish/config.fish)
pred completions fish | source")]
Completions {
/// Shell type (bash, zsh, fish, etc.). Auto-detected if omitted.
shell: Option<clap_complete::Shell>,
},
}
#[derive(Clone, Debug, ValueEnum)]
pub enum ExampleSide {
Source,
Target,
}
#[derive(clap::Args)]
#[command(after_help = "\
TIP: Run `pred create <PROBLEM>` (no other flags) to see problem-specific help.
Not every flag applies to every problem — the above list shows ALL flags.
Flags by problem type:
MIS, MVC, MaxClique, MinDomSet --graph, --weights
MaxCut, MaxMatching, TSP, BottleneckTravelingSalesman --graph, --edge-weights
LongestPath --graph, --edge-lengths, --source-vertex, --target-vertex
HamiltonianPathBetweenTwoVertices --graph, --source-vertex, --target-vertex
ShortestWeightConstrainedPath --graph, --edge-lengths, --edge-weights, --source-vertex, --target-vertex, --weight-bound
GraphPartitioning --graph, --num-partitions
MaximalIS --graph, --weights
SAT, NAESAT --num-vars, --clauses
KSAT --num-vars, --clauses [--k]
NonTautology --num-vars, --disjuncts
QUBO --matrix
SpinGlass --graph, --couplings, --fields
KColoring --graph, --k
KClique --graph, --k
VertexCover (VC) --graph, --k
MinimumMultiwayCut --graph, --terminals, --edge-weights
MonochromaticTriangle --graph
PartitionIntoTriangles --graph
GeneralizedHex --graph, --source, --sink
IntegralFlowWithMultipliers --arcs, --capacities, --source, --sink, --multipliers, --requirement
MinimumEdgeCostFlow --arcs, --edge-weights (prices), --capacities, --source, --sink, --requirement
MinimumCutIntoBoundedSets --graph, --edge-weights, --source, --sink, --size-bound
HamiltonianCircuit, HC --graph
MaximumLeafSpanningTree --graph
LongestCircuit --graph, --edge-weights
BoundedComponentSpanningForest --graph, --weights, --k, --max-weight
UndirectedFlowLowerBounds --graph, --capacities, --lower-bounds, --source, --sink, --requirement
IntegralFlowBundles --arcs, --bundles, --bundle-capacities, --source, --sink, --requirement [--num-vertices]
UndirectedTwoCommodityIntegralFlow --graph, --capacities, --source-1, --sink-1, --source-2, --sink-2, --requirement-1, --requirement-2
DisjointConnectingPaths --graph, --terminal-pairs
IntegralFlowHomologousArcs --arcs, --capacities, --source, --sink, --requirement, --homologous-pairs
IsomorphicSpanningTree --graph, --tree
KthBestSpanningTree --graph, --edge-weights, --k, --bound
LengthBoundedDisjointPaths --graph, --source, --sink, --max-length
PathConstrainedNetworkFlow --arcs, --capacities, --source, --sink, --paths, --requirement
Factoring --target, --m, --n
BinPacking --sizes, --capacity
Clustering --distance-matrix, --k, --diameter-bound
CapacityAssignment --capacities, --cost-matrix, --delay-matrix, --cost-budget, --delay-budget
ProductionPlanning --num-periods, --demands, --capacities, --setup-costs, --production-costs, --inventory-costs, --cost-bound
SubsetProduct --sizes, --target
SubsetSum --sizes, --target
MinimumAxiomSet --n, --true-sentences, --implications
Numerical3DimensionalMatching --w-sizes, --x-sizes, --y-sizes, --bound
Betweenness --n, --sets (triples a,b,c)
CyclicOrdering --n, --sets (triples a,b,c)
ThreePartition --sizes, --bound
DynamicStorageAllocation --release-times, --deadlines, --sizes, --capacity
KthLargestMTuple --sets, --k, --bound
QuadraticCongruences --coeff-a, --coeff-b, --coeff-c
QuadraticDiophantineEquations --coeff-a, --coeff-b, --coeff-c
SimultaneousIncongruences --pairs (semicolon-separated a,b pairs)
SumOfSquaresPartition --sizes, --num-groups
ExpectedRetrievalCost --probabilities, --num-sectors
PaintShop --sequence
MaximumSetPacking --subsets [--weights]
MinimumHittingSet --universe-size, --subsets
MinimumSetCovering --universe-size, --subsets [--weights]
EnsembleComputation --universe-size, --subsets, --budget
ComparativeContainment --universe-size, --r-sets, --s-sets [--r-weights] [--s-weights]
X3C (ExactCoverBy3Sets) --universe-size, --subsets (3 elements each)
3DM (ThreeDimensionalMatching) --universe-size, --subsets (triples w,x,y)
ThreeMatroidIntersection --universe-size, --partitions, --bound
SetBasis --universe-size, --subsets, --k
MinimumCardinalityKey --num-attributes, --dependencies
PrimeAttributeName --universe-size, --dependencies, --query-attribute
RootedTreeStorageAssignment --universe-size, --subsets, --bound
TwoDimensionalConsecutiveSets --alphabet-size, --subsets
BicliqueCover --left, --right, --biedges, --k
BalancedCompleteBipartiteSubgraph --left, --right, --biedges, --k
BiconnectivityAugmentation --graph, --potential-weights, --budget [--num-vertices]
PartialFeedbackEdgeSet --graph, --budget, --max-cycle-length [--num-vertices]
BMF --matrix (0/1), --rank
ConsecutiveBlockMinimization --matrix (JSON 2D bool), --bound-k
ConsecutiveOnesMatrixAugmentation --matrix (0/1), --bound
ConsecutiveOnesSubmatrix --matrix (0/1), --k
SparseMatrixCompression --matrix (0/1), --bound
MaximumLikelihoodRanking --matrix (i32 rows, semicolon-separated)
MinimumMatrixCover --matrix (i64 rows, semicolon-separated)
MinimumWeightDecoding --matrix (JSON 2D bool), --rhs (comma-separated booleans)
FeasibleBasisExtension --matrix (JSON 2D i64), --rhs, --required-columns
SteinerTree --graph, --edge-weights, --terminals
MultipleCopyFileAllocation --graph, --usage, --storage
AcyclicPartition --arcs [--weights] [--arc-weights] --weight-bound --cost-bound [--num-vertices]
CVP --basis, --target-vec [--bounds]
MultiprocessorScheduling --lengths, --num-processors, --deadline
SchedulingToMinimizeWeightedCompletionTime --lengths, --weights, --num-processors
SequencingWithinIntervals --release-times, --deadlines, --lengths
OptimalLinearArrangement --graph
RootedTreeArrangement --graph, --bound
MinMaxMulticenter (pCenter) --graph, --weights, --edge-weights, --k
MixedChinesePostman (MCPP) --graph, --arcs, --edge-weights, --arc-weights [--num-vertices]
RuralPostman (RPP) --graph, --edge-weights, --required-edges
StackerCrane --arcs, --graph, --arc-lengths, --edge-lengths [--num-vertices]
MultipleChoiceBranching --arcs [--weights] --partition --threshold [--num-vertices]
AdditionalKey --num-attributes, --dependencies, --relation-attrs [--known-keys]
ConsistencyOfDatabaseFrequencyTables --num-objects, --attribute-domains, --frequency-tables [--known-values]
SubgraphIsomorphism --graph (host), --pattern (pattern)
GroupingBySwapping --string, --bound [--alphabet-size]
LCS --strings [--alphabet-size]
FAS --arcs [--weights] [--num-vertices]
FVS --arcs [--weights] [--num-vertices]
QBF --num-vars, --clauses, --quantifiers
SteinerTreeInGraphs --graph, --edge-weights, --terminals
PartitionIntoPathsOfLength2 --graph
ResourceConstrainedScheduling --num-processors, --resource-bounds, --resource-requirements, --deadline
IntegerKnapsack --sizes, --values, --capacity
PartiallyOrderedKnapsack --sizes, --values, --capacity, --precedences
QAP --matrix (cost), --distance-matrix
StrongConnectivityAugmentation --arcs, --candidate-arcs, --bound [--num-vertices]
JobShopScheduling --jobs [--num-processors]
FlowShopScheduling --task-lengths, --deadline [--num-processors]
StaffScheduling --schedules, --requirements, --num-workers, --k
TimetableDesign --num-periods, --num-craftsmen, --num-tasks, --craftsman-avail, --task-avail, --requirements
MinimumTardinessSequencing --num-tasks, --deadlines [--precedences]
RectilinearPictureCompression --matrix (0/1), --k
SchedulingWithIndividualDeadlines --num-tasks, --num-processors/--m, --deadlines [--precedences]
SequencingToMinimizeMaximumCumulativeCost --costs [--precedences]
SequencingToMinimizeTardyTaskWeight --lengths, --weights, --deadlines
SequencingToMinimizeWeightedCompletionTime --lengths, --weights [--precedences]
SequencingToMinimizeWeightedTardiness --lengths, --weights, --deadlines, --bound
SequencingWithDeadlinesAndSetUpTimes --lengths, --deadlines, --compilers, --setup-times
MinimumExternalMacroDataCompression --string, --pointer-cost [--alphabet-size]
MinimumInternalMacroDataCompression --string, --pointer-cost [--alphabet-size]
SCS --strings [--alphabet-size]
StringToStringCorrection --source-string, --target-string, --bound [--alphabet-size]
D2CIF --arcs, --capacities, --source-1, --sink-1, --source-2, --sink-2, --requirement-1, --requirement-2
MinimumDummyActivitiesPert --arcs [--num-vertices]
FeasibleRegisterAssignment --arcs, --assignment, --k [--num-vertices]
MinimumFaultDetectionTestSet --arcs, --inputs, --outputs [--num-vertices]
MinimumWeightAndOrGraph --arcs, --source, --gate-types, --weights [--num-vertices]
MinimumCodeGenerationOneRegister --arcs [--num-vertices]
MinimumCodeGenerationParallelAssignments --num-variables, --assignments
MinimumCodeGenerationUnlimitedRegisters --left-arcs, --right-arcs [--num-vertices]
MinimumRegisterSufficiencyForLoops --loop-length, --loop-variables
RegisterSufficiency --arcs, --bound [--num-vertices]
CBQ --domain-size, --relations, --conjuncts-spec
IntegerExpressionMembership --expression (JSON), --target
MinimumGeometricConnectedDominatingSet --positions (float x,y pairs), --radius
MinimumDecisionTree --test-matrix (JSON 2D bool), --num-objects, --num-tests
MinimumDisjunctiveNormalForm (MinDNF) --num-vars, --truth-table
SquareTiling (WangTiling) --num-colors, --tiles, --grid-size
ILP, CircuitSAT (via reduction only)
Geometry graph variants (use slash notation, e.g., MIS/KingsSubgraph):
KingsSubgraph, TriangularSubgraph --positions (integer x,y pairs)
UnitDiskGraph --positions (float x,y pairs) [--radius]
Random generation:
--random --num-vertices N [--edge-prob 0.5] [--seed 42]
Examples:
pred create --example MIS/SimpleGraph/i32
pred create --example MVC/SimpleGraph/i32 --to MIS/SimpleGraph/i32
pred create --example MVC/SimpleGraph/i32 --to MIS/SimpleGraph/i32 --example-side target
pred create MIS --graph 0-1,1-2,2-3 --weights 1,1,1
pred create SAT --num-vars 3 --clauses \"1,2;-1,3\"
pred create NonTautology --num-vars 3 --disjuncts \"1,2,3;-1,-2,-3\"
pred create QUBO --matrix \"1,0.5;0.5,2\"
pred create CapacityAssignment --capacities 1,2,3 --cost-matrix \"1,3,6;2,4,7;1,2,5\" --delay-matrix \"8,4,1;7,3,1;6,3,1\" --cost-budget 10 --delay-budget 12
pred create ProductionPlanning --num-periods 6 --demands 5,3,7,2,8,5 --capacities 12,12,12,12,12,12 --setup-costs 10,10,10,10,10,10 --production-costs 1,1,1,1,1,1 --inventory-costs 1,1,1,1,1,1 --cost-bound 80
pred create GeneralizedHex --graph 0-1,0-2,0-3,1-4,2-4,3-4,4-5 --source 0 --sink 5
pred create IntegralFlowWithMultipliers --arcs \"0>1,0>2,1>3,2>3\" --capacities 1,1,2,2 --source 0 --sink 3 --multipliers 1,2,3,1 --requirement 2
pred create MultipleChoiceBranching/i32 --arcs \"0>1,0>2,1>3,2>3,1>4,3>5,4>5,2>4\" --weights 3,2,4,1,2,3,1,3 --partition \"0,1;2,3;4,7;5,6\" --bound 10
pred create GroupingBySwapping --string \"0,1,2,0,1,2\" --bound 5 | pred solve - --solver brute-force
pred create StringToStringCorrection --source-string \"0,1,2,3,1,0\" --target-string \"0,1,3,2,1\" --bound 2 | pred solve - --solver brute-force
pred create MIS/KingsSubgraph --positions \"0,0;1,0;1,1;0,1\"
pred create MIS/UnitDiskGraph --positions \"0,0;1,0;0.5,0.8\" --radius 1.5
pred create MIS --random --num-vertices 10 --edge-prob 0.3
pred create MultiprocessorScheduling --lengths 4,5,3,2,6 --num-processors 2 --deadline 10
pred create SchedulingToMinimizeWeightedCompletionTime --lengths 1,2,3,4,5 --weights 6,4,3,2,1 --num-processors 2
pred create UndirectedFlowLowerBounds --graph 0-1,0-2,1-3,2-3,1-4,3-5,4-5 --capacities 2,2,2,2,1,3,2 --lower-bounds 1,1,0,0,1,0,1 --source 0 --sink 5 --requirement 3
pred create ConsistencyOfDatabaseFrequencyTables --num-objects 6 --attribute-domains \"2,3,2\" --frequency-tables \"0,1:1,1,1|1,1,1;1,2:1,1|0,2|1,1\" --known-values \"0,0,0;3,0,1;1,2,1\"
pred create BiconnectivityAugmentation --graph 0-1,1-2,2-3 --potential-weights 0-2:3,0-3:4,1-3:2 --budget 5
pred create FVS --arcs \"0>1,1>2,2>0\" --weights 1,1,1
pred create MinimumDummyActivitiesPert --arcs \"0>2,0>3,1>3,1>4,2>5\" --num-vertices 6
pred create UndirectedTwoCommodityIntegralFlow --graph 0-2,1-2,2-3 --capacities 1,1,2 --source-1 0 --sink-1 3 --source-2 1 --sink-2 3 --requirement-1 1 --requirement-2 1
pred create IntegralFlowHomologousArcs --arcs \"0>1,0>2,1>3,2>3,1>4,2>4,3>5,4>5\" --capacities 1,1,1,1,1,1,1,1 --source 0 --sink 5 --requirement 2 --homologous-pairs \"2=5;4=3\"
pred create X3C --universe 9 --subsets \"0,1,2;0,2,4;3,4,5;3,5,7;6,7,8;1,4,6;2,5,8\"
pred create SetBasis --universe 4 --subsets \"0,1;1,2;0,2;0,1,2\" --k 3
pred create MinimumCardinalityKey --num-attributes 6 --dependencies \"0,1>2;0,2>3;1,3>4;2,4>5\"
pred create PrimeAttributeName --universe 6 --dependencies \"0,1>2,3,4,5;2,3>0,1,4,5\" --query-attribute 3
pred create TwoDimensionalConsecutiveSets --alphabet-size 6 --subsets \"0,1,2;3,4,5;1,3;2,4;0,5\"")]
pub struct CreateArgs {
/// Problem type (e.g., MIS, QUBO, SAT). Omit when using --example.
#[arg(value_parser = crate::problem_name::ProblemNameParser)]
pub problem: Option<String>,
/// Build a problem from the canonical example database using a structural problem spec.
#[arg(long, value_parser = crate::problem_name::ProblemNameParser)]
pub example: Option<String>,
/// Target problem spec for canonical rule example lookup.
#[arg(long = "to", value_parser = crate::problem_name::ProblemNameParser)]
pub example_target: Option<String>,
/// Which side of a rule example to emit [default: source].
#[arg(long, value_enum, default_value = "source")]
pub example_side: ExampleSide,
/// Graph edge list (e.g., 0-1,1-2,2-3)
#[arg(long)]
pub graph: Option<String>,
/// Vertex weights (e.g., 1,1,1,1) [default: all 1s]
#[arg(long)]
pub weights: Option<String>,
/// Edge weights (e.g., 2,3,1) [default: all 1s]
#[arg(long)]
pub edge_weights: Option<String>,
/// Edge lengths (e.g., 2,3,1) [default: all 1s]
#[arg(long)]
pub edge_lengths: Option<String>,
/// Capacities (edge capacities for flow problems, capacity levels for CapacityAssignment)
#[arg(long)]
pub capacities: Option<String>,
/// Demands for ProductionPlanning (comma-separated, e.g., "5,3,7,2,8,5")
#[arg(long)]
pub demands: Option<String>,
/// Setup costs for ProductionPlanning (comma-separated, e.g., "10,10,10,10,10,10")
#[arg(long)]
pub setup_costs: Option<String>,
/// Per-unit production costs for ProductionPlanning (comma-separated, e.g., "1,1,1,1,1,1")
#[arg(long)]
pub production_costs: Option<String>,
/// Per-unit inventory costs for ProductionPlanning (comma-separated, e.g., "1,1,1,1,1,1")
#[arg(long)]
pub inventory_costs: Option<String>,
/// Bundle capacities for IntegralFlowBundles (e.g., 1,1,1)
#[arg(long)]
pub bundle_capacities: Option<String>,
/// Cost matrix for CapacityAssignment (semicolon-separated rows, e.g., "1,3,6;2,4,7")
#[arg(long)]
pub cost_matrix: Option<String>,
/// Delay matrix for CapacityAssignment (semicolon-separated rows, e.g., "8,4,1;7,3,1")
#[arg(long)]
pub delay_matrix: Option<String>,
/// Edge lower bounds for lower-bounded flow problems (e.g., 1,1,0,0,1,0,1)
#[arg(long)]
pub lower_bounds: Option<String>,
/// Vertex multipliers in vertex order (e.g., 1,2,3,1)
#[arg(long)]
pub multipliers: Option<String>,
/// Source vertex for path-based graph problems and MinimumCutIntoBoundedSets
#[arg(long)]
pub source: Option<usize>,
/// Sink vertex for path-based graph problems and MinimumCutIntoBoundedSets
#[arg(long)]
pub sink: Option<usize>,
/// Required total flow R for IntegralFlowBundles, IntegralFlowHomologousArcs, IntegralFlowWithMultipliers, PathConstrainedNetworkFlow, and UndirectedFlowLowerBounds
#[arg(long)]
pub requirement: Option<u64>,
/// Required number of paths for LengthBoundedDisjointPaths
#[arg(long)]
pub num_paths_required: Option<usize>,
/// Prescribed directed s-t paths as semicolon-separated arc-index sequences (e.g., "0,2,5;1,4,6")
#[arg(long)]
pub paths: Option<String>,
/// Pairwise couplings J_ij for SpinGlass (e.g., 1,-1,1) [default: all 1s]
#[arg(long)]
pub couplings: Option<String>,
/// On-site fields h_i for SpinGlass (e.g., 0,0,1) [default: all 0s]
#[arg(long)]
pub fields: Option<String>,
/// Clauses for SAT problems (semicolon-separated, e.g., "1,2;-1,3")
#[arg(long)]
pub clauses: Option<String>,
/// Disjuncts for NonTautology (semicolon-separated, e.g., "1,2;-1,3")
#[arg(long)]
pub disjuncts: Option<String>,
/// Number of variables (for SAT/KSAT)
#[arg(long)]
pub num_vars: Option<usize>,
/// Matrix input. QUBO uses semicolon-separated numeric rows ("1,0.5;0.5,2");
/// ConsecutiveBlockMinimization uses a JSON 2D bool array ('[[true,false],[false,true]]')
#[arg(long)]
pub matrix: Option<String>,
/// Shared integer parameter (use `pred create <PROBLEM>` for the problem-specific meaning)
#[arg(long)]
pub k: Option<usize>,
/// Number of partitions for GraphPartitioning (currently must be 2)
#[arg(long)]
pub num_partitions: Option<usize>,
/// Generate a random instance (graph-based problems only)
#[arg(long)]
pub random: bool,
/// Number of vertices for random graph generation
#[arg(long)]
pub num_vertices: Option<usize>,
/// Source vertex for path problems
#[arg(long)]
pub source_vertex: Option<usize>,
/// Target vertex for path problems
#[arg(long)]
pub target_vertex: Option<usize>,
/// Edge probability for random graph generation (0.0 to 1.0) [default: 0.5]
#[arg(long)]
pub edge_prob: Option<f64>,
/// Random seed for reproducibility
#[arg(long)]
pub seed: Option<u64>,
/// Target value (for Factoring, SubsetSum, and SubsetProduct)
#[arg(long)]
pub target: Option<String>,
/// Bits for first factor (for Factoring); also accepted as a processor-count alias for scheduling create commands
#[arg(long)]
pub m: Option<usize>,
/// Bits for second factor (for Factoring)
#[arg(long)]
pub n: Option<usize>,
/// Vertex positions for geometry-based graphs (semicolon-separated x,y pairs, e.g., "0,0;1,0;1,1")
#[arg(long)]
pub positions: Option<String>,
/// Radius for UnitDiskGraph [default: 1.0]
#[arg(long)]
pub radius: Option<f64>,
/// Source vertex s_1 for commodity 1
#[arg(long)]
pub source_1: Option<usize>,
/// Sink vertex t_1 for commodity 1
#[arg(long)]
pub sink_1: Option<usize>,
/// Source vertex s_2 for commodity 2
#[arg(long)]
pub source_2: Option<usize>,
/// Sink vertex t_2 for commodity 2
#[arg(long)]
pub sink_2: Option<usize>,
/// Required flow R_1 for commodity 1
#[arg(long)]
pub requirement_1: Option<u64>,
/// Required flow R_2 for commodity 2
#[arg(long)]
pub requirement_2: Option<u64>,
/// Item sizes for BinPacking (comma-separated, e.g., "3,3,2,2")
#[arg(long)]
pub sizes: Option<String>,
/// Record access probabilities for ExpectedRetrievalCost (comma-separated, e.g., "0.2,0.15,0.15,0.2,0.1,0.2")
#[arg(long)]
pub probabilities: Option<String>,
/// Bin capacity for BinPacking
#[arg(long)]
pub capacity: Option<String>,
/// Car paint sequence for PaintShop (comma-separated, each label appears exactly twice, e.g., "a,b,a,c,c,b")
#[arg(long)]
pub sequence: Option<String>,
/// Subsets for set-system problems such as SetPacking, MinimumHittingSet, and SetCovering (semicolon-separated, e.g., "0,1;1,2;0,2")
#[arg(long = "subsets", alias = "sets")]
pub sets: Option<String>,
/// R-family sets for ComparativeContainment (semicolon-separated, e.g., "0,1;1,2")
#[arg(long)]
pub r_sets: Option<String>,
/// S-family sets for ComparativeContainment (semicolon-separated, e.g., "0,1;1,2")
#[arg(long)]
pub s_sets: Option<String>,
/// R-family weights for ComparativeContainment (comma-separated, e.g., "2,5")
#[arg(long)]
pub r_weights: Option<String>,
/// S-family weights for ComparativeContainment (comma-separated, e.g., "3,6")
#[arg(long)]
pub s_weights: Option<String>,
/// Partition groups for arc-index partitions (semicolon-separated, e.g., "0,1;2,3")
#[arg(long)]
pub partition: Option<String>,
/// Three partition matroids for ThreeMatroidIntersection (pipe-separated matroids, semicolon-separated groups, e.g., "0,1,2;3,4,5|0,3;1,4;2,5|0,4;1,5;2,3")
#[arg(long)]
pub partitions: Option<String>,
/// Arc bundles for IntegralFlowBundles (semicolon-separated groups of arc indices, e.g., "0,1;2,5;3,4")
#[arg(long)]
pub bundles: Option<String>,
/// Universe size for set-system problems such as MinimumHittingSet, MinimumSetCovering, and ComparativeContainment
#[arg(long = "universe-size", alias = "universe")]
pub universe: Option<usize>,
/// Bipartite graph edges for BicliqueCover / BalancedCompleteBipartiteSubgraph (e.g., "0-0,0-1,1-2" for left-right pairs)
#[arg(long)]
pub biedges: Option<String>,
/// Left partition size for BicliqueCover / BalancedCompleteBipartiteSubgraph
#[arg(long)]
pub left: Option<usize>,
/// Right partition size for BicliqueCover / BalancedCompleteBipartiteSubgraph
#[arg(long)]
pub right: Option<usize>,
/// Rank for BMF
#[arg(long)]
pub rank: Option<usize>,
/// Lattice basis for CVP (semicolon-separated column vectors, e.g., "1,0;0,1")
#[arg(long)]
pub basis: Option<String>,
/// Target vector for CVP (comma-separated, e.g., "0.5,0.5")
#[arg(long)]
pub target_vec: Option<String>,
/// Variable bounds for CVP as "lower,upper" (e.g., "-10,10") [default: -10,10]
#[arg(long, allow_hyphen_values = true)]
pub bounds: Option<String>,
/// Release times for SequencingWithinIntervals (comma-separated, e.g., "0,0,5")
#[arg(long)]
pub release_times: Option<String>,
/// Processing lengths (comma-separated, e.g., "4,5,3,2,6")
#[arg(long)]
pub lengths: Option<String>,
/// Terminal vertices for SteinerTree or MinimumMultiwayCut (comma-separated indices, e.g., "0,2,4")
#[arg(long)]
pub terminals: Option<String>,
/// Terminal pairs for DisjointConnectingPaths (comma-separated pairs, e.g., "0-3,2-5")
#[arg(long = "terminal-pairs")]
pub terminal_pairs: Option<String>,
/// Tree edge list for IsomorphicSpanningTree (e.g., 0-1,1-2,2-3)
#[arg(long)]
pub tree: Option<String>,
/// Required edge indices for RuralPostman (comma-separated, e.g., "0,2,4")
#[arg(long)]
pub required_edges: Option<String>,
/// Bound parameter (upper or length bound for BoundedComponentSpanningForest, GroupingBySwapping, LengthBoundedDisjointPaths, MultipleChoiceBranching, RootedTreeArrangement, or StringToStringCorrection)
#[arg(
long,
alias = "max-length",
alias = "max-weight",
alias = "bound-k",
alias = "threshold",
allow_hyphen_values = true
)]
pub bound: Option<i64>,
/// Upper bound on expected retrieval latency for ExpectedRetrievalCost
#[arg(long)]
pub latency_bound: Option<f64>,
/// Upper bound on total path length
#[arg(long)]
pub length_bound: Option<i32>,
/// Upper bound on total path weight
#[arg(long)]
pub weight_bound: Option<i32>,
/// Upper bound on tree diameter (in edges) for BoundedDiameterSpanningTree
#[arg(long)]
pub diameter_bound: Option<usize>,
/// Upper bound on total inter-partition arc cost
#[arg(long)]
pub cost_bound: Option<i32>,
/// Budget on total delay penalty for CapacityAssignment
#[arg(long)]
pub delay_budget: Option<u64>,
/// Pattern graph edge list for SubgraphIsomorphism (e.g., 0-1,1-2,2-0)
#[arg(long)]
pub pattern: Option<String>,
/// Input strings for LCS (e.g., "ABAC;BACA" or "0,1,0;1,0,1") or SCS (e.g., "0,1,2;1,2,0")
#[arg(long)]
pub strings: Option<String>,
/// Input string for GroupingBySwapping (comma-separated symbol indices, e.g., "0,1,2,0,1,2")
#[arg(long)]
pub string: Option<String>,
/// Task costs for SequencingToMinimizeMaximumCumulativeCost (comma-separated, e.g., "2,-1,3,-2,1,-3")
#[arg(long, allow_hyphen_values = true)]
pub costs: Option<String>,
/// Arc weights/lengths for directed graph problems with per-arc costs (comma-separated, e.g., "1,1,2,3")
#[arg(long = "arc-weights", alias = "arc-costs", alias = "arc-lengths")]
pub arc_costs: Option<String>,
/// Directed arcs for directed graph problems (e.g., 0>1,1>2,2>0)
#[arg(long)]
pub arcs: Option<String>,
/// Left operand arcs for MinimumCodeGenerationUnlimitedRegisters (e.g., 1>3,2>3,0>1)
#[arg(long)]
pub left_arcs: Option<String>,
/// Right operand arcs for MinimumCodeGenerationUnlimitedRegisters (e.g., 1>4,2>4,0>2)
#[arg(long)]
pub right_arcs: Option<String>,
/// Arc-index equality constraints for IntegralFlowHomologousArcs (semicolon-separated, e.g., "2=5;4=3")
#[arg(long)]
pub homologous_pairs: Option<String>,
/// Quantifiers for QBF (comma-separated, E=Exists, A=ForAll, e.g., "E,A,E")
#[arg(long)]
pub quantifiers: Option<String>,
/// Size bound for partition sets (for MinimumCutIntoBoundedSets)
#[arg(long)]
pub size_bound: Option<usize>,
/// Cut weight bound (for MinimumCutIntoBoundedSets)
#[arg(long)]
pub cut_bound: Option<i32>,
/// Item values (e.g., 3,4,5,7) for PartiallyOrderedKnapsack
#[arg(long)]
pub values: Option<String>,
/// Precedence pairs (e.g., "0>2,0>3,1>4") for PartiallyOrderedKnapsack
#[arg(long, alias = "item-precedences")]
pub precedences: Option<String>,
/// Distance matrix for QuadraticAssignment (semicolon-separated rows, e.g., "0,1,2;1,0,1;2,1,0")
#[arg(long)]
pub distance_matrix: Option<String>,
/// Weighted potential augmentation edges (e.g., 0-2:3,1-3:5)
#[arg(long = "potential-weights", alias = "potential-edges")]
pub potential_edges: Option<String>,
/// Total budget for selected potential edges
#[arg(long)]
pub budget: Option<String>,
/// Maximum cycle length L for PartialFeedbackEdgeSet
#[arg(long)]
pub max_cycle_length: Option<usize>,
/// Candidate weighted arcs for StrongConnectivityAugmentation (e.g., 2>0:1,2>1:3)
#[arg(long)]
pub candidate_arcs: Option<String>,
/// Usage frequencies for MultipleCopyFileAllocation (comma-separated, e.g., "5,4,3,2")
#[arg(long)]
pub usage: Option<String>,
/// Storage costs for MultipleCopyFileAllocation (comma-separated, e.g., "1,1,1,1")
#[arg(long)]
pub storage: Option<String>,
/// Deadlines for MinimumTardinessSequencing or SchedulingWithIndividualDeadlines (comma-separated, e.g., "5,5,5,3,3")
#[arg(long)]
pub deadlines: Option<String>,
/// Precedence pairs for MinimumTardinessSequencing, SchedulingWithIndividualDeadlines, or SequencingToMinimizeWeightedCompletionTime (e.g., "0>3,1>3,1>4,2>4")
#[arg(long)]
pub precedence_pairs: Option<String>,
/// Resource bounds for ResourceConstrainedScheduling (comma-separated, e.g., "20,15")
#[arg(long)]
pub resource_bounds: Option<String>,
/// Resource requirements for ResourceConstrainedScheduling (semicolon-separated rows, each row comma-separated, e.g., "6,3;7,4;5,2")
#[arg(long)]
pub resource_requirements: Option<String>,
/// Task lengths for FlowShopScheduling (semicolon-separated rows: "3,4,2;2,3,5;4,1,3")
#[arg(long)]
pub task_lengths: Option<String>,
/// Job tasks for JobShopScheduling (semicolon-separated jobs, comma-separated processor:length tasks, e.g., "0:3,1:4;1:2,0:3,1:2")
#[arg(long = "jobs", alias = "job-tasks")]
pub job_tasks: Option<String>,
/// Deadline for FlowShopScheduling, MultiprocessorScheduling, or ResourceConstrainedScheduling
#[arg(long)]
pub deadline: Option<u64>,
/// Number of processors/machines for FlowShopScheduling, JobShopScheduling, MultiprocessorScheduling, ResourceConstrainedScheduling, SchedulingToMinimizeWeightedCompletionTime, or SchedulingWithIndividualDeadlines
#[arg(long)]
pub num_processors: Option<usize>,
/// Binary schedule patterns for StaffScheduling (semicolon-separated rows, e.g., "1,1,0;0,1,1")
#[arg(long)]
pub schedules: Option<String>,
/// Requirements for StaffScheduling (comma-separated) or TimetableDesign (semicolon-separated rows)
#[arg(long)]
pub requirements: Option<String>,
/// Number of available workers for StaffScheduling
#[arg(long)]
pub num_workers: Option<u64>,
/// Number of work periods for TimetableDesign
#[arg(long)]
pub num_periods: Option<usize>,
/// Number of craftsmen for TimetableDesign
#[arg(long)]
pub num_craftsmen: Option<usize>,
/// Number of tasks for TimetableDesign
#[arg(long)]
pub num_tasks: Option<usize>,
/// Craftsman availability rows for TimetableDesign (semicolon-separated 0/1 rows)
#[arg(long)]
pub craftsman_avail: Option<String>,
/// Task availability rows for TimetableDesign (semicolon-separated 0/1 rows)
#[arg(long)]
pub task_avail: Option<String>,
/// Alphabet size for GroupingBySwapping, LCS, SCS, StringToStringCorrection, or TwoDimensionalConsecutiveSets (optional; inferred from the input strings if omitted)
#[arg(long)]
pub alphabet_size: Option<usize>,
/// Number of attributes for AdditionalKey or MinimumCardinalityKey
#[arg(long)]
pub num_attributes: Option<usize>,
/// Functional dependencies for AdditionalKey (e.g., "0,1:2,3;2,3:4,5") or MinimumCardinalityKey (semicolon-separated "lhs>rhs" pairs, e.g., "0,1>2;0,2>3")
#[arg(long)]
pub dependencies: Option<String>,
/// Relation scheme attributes for AdditionalKey (comma-separated, e.g., "0,1,2,3,4,5")
#[arg(long)]
pub relation_attrs: Option<String>,
/// Known candidate keys for AdditionalKey (e.g., "0,1;2,3")
#[arg(long)]
pub known_keys: Option<String>,
/// Number of objects for ConsistencyOfDatabaseFrequencyTables
#[arg(long)]
pub num_objects: Option<usize>,
/// Attribute-domain sizes for ConsistencyOfDatabaseFrequencyTables (comma-separated, e.g., "2,3,2")
#[arg(long)]
pub attribute_domains: Option<String>,
/// Pairwise frequency tables for ConsistencyOfDatabaseFrequencyTables (e.g., "0,1:1,1|0,1;1,2:1,0|0,1")
#[arg(long)]
pub frequency_tables: Option<String>,
/// Known value triples for ConsistencyOfDatabaseFrequencyTables (e.g., "0,0,0;3,1,2")
#[arg(long)]
pub known_values: Option<String>,
/// Domain size for ConjunctiveBooleanQuery
#[arg(long)]
pub domain_size: Option<usize>,
/// Relations for ConjunctiveBooleanQuery (format: "arity:tuple1|tuple2;arity:tuple1|tuple2")
#[arg(long)]
pub relations: Option<String>,
/// Conjuncts for ConjunctiveBooleanQuery (format: "rel:args;rel:args" where args use v0,v1 for variables, c0,c1 for constants)
#[arg(long)]
pub conjuncts_spec: Option<String>,
/// Functional dependencies (semicolon-separated, each dep is lhs>rhs with comma-separated indices, e.g., "0,1>2,3;2,3>0,1")
#[arg(long)]
pub deps: Option<String>,
/// Query attribute index for PrimeAttributeName
#[arg(long = "query-attribute", alias = "query")]
pub query: Option<usize>,
/// Right-hand side vector for FeasibleBasisExtension (comma-separated, e.g., "7,5,3")
#[arg(long)]
pub rhs: Option<String>,
/// Required column indices for FeasibleBasisExtension (comma-separated, e.g., "0,1")
#[arg(long)]
pub required_columns: Option<String>,
/// Number of groups for SumOfSquaresPartition
#[arg(long)]
pub num_groups: Option<usize>,
/// Number of sectors for ExpectedRetrievalCost
#[arg(long)]
pub num_sectors: Option<usize>,
/// Compiler index for each task in SequencingWithDeadlinesAndSetUpTimes (comma-separated, e.g., "0,1,0,1,0")
#[arg(long)]
pub compilers: Option<String>,
/// Setup times per compiler for SequencingWithDeadlinesAndSetUpTimes (comma-separated, e.g., "1,2")
#[arg(long)]
pub setup_times: Option<String>,
/// Source string for StringToStringCorrection (comma-separated symbol indices, e.g., "0,1,2,3")
#[arg(long)]
pub source_string: Option<String>,
/// Target string for StringToStringCorrection (comma-separated symbol indices, e.g., "0,1,3,2")
#[arg(long)]
pub target_string: Option<String>,
/// Pointer cost for MinimumExternalMacroDataCompression (positive integer)
#[arg(long)]
pub pointer_cost: Option<usize>,
/// Expression tree for IntegerExpressionMembership (JSON, e.g., '{"Sum":[{"Atom":1},{"Atom":2}]}')
#[arg(long)]
pub expression: Option<String>,
/// Equations for AlgebraicEquationsOverGF2 (semicolon-separated polynomials, each a colon-separated list of monomials, each a comma-separated list of variable indices; empty monomial = constant 1; e.g., "0,1:2;1,2:0:;0:1:2:")
#[arg(long)]
pub equations: Option<String>,
/// Register assignment for FeasibleRegisterAssignment (comma-separated register indices, e.g., "0,1,0,0")
#[arg(long)]
pub assignment: Option<String>,
/// Coefficient/parameter a for QuadraticCongruences (residue target) or QuadraticDiophantineEquations (coefficient of x²)
#[arg(long)]
pub coeff_a: Option<String>,
/// Coefficient/parameter b for QuadraticCongruences (modulus) or QuadraticDiophantineEquations (coefficient of y)
#[arg(long)]
pub coeff_b: Option<String>,
/// Constant c for QuadraticCongruences (search-space bound) or QuadraticDiophantineEquations (right-hand side of ax² + by = c)
#[arg(long)]
pub coeff_c: Option<String>,
/// Incongruence pairs for SimultaneousIncongruences (semicolon-separated "a,b" pairs, e.g., "2,2;1,3;2,5;3,7")
#[arg(long)]
pub pairs: Option<String>,
/// W-set sizes for Numerical3DimensionalMatching (comma-separated, e.g., "4,5")
#[arg(long)]
pub w_sizes: Option<String>,
/// X-set sizes for Numerical3DimensionalMatching (comma-separated, e.g., "4,5")
#[arg(long)]
pub x_sizes: Option<String>,
/// Y-set sizes for Numerical3DimensionalMatching (comma-separated, e.g., "5,7")
#[arg(long)]
pub y_sizes: Option<String>,
/// Initial marking for NonLivenessFreePetriNet (comma-separated tokens per place, e.g., "1,0,0,0")
#[arg(long)]
pub initial_marking: Option<String>,
/// Output arcs (transition-to-place) for NonLivenessFreePetriNet (e.g., "0>1,1>2,2>3")
#[arg(long)]
pub output_arcs: Option<String>,
/// Gate types for MinimumWeightAndOrGraph (comma-separated: AND, OR, or L for leaf, e.g., "AND,OR,OR,L,L,L,L")
#[arg(long)]
pub gate_types: Option<String>,
/// Input vertex indices (comma-separated, e.g., "0,1")
#[arg(long)]
pub inputs: Option<String>,
/// Output vertex indices (comma-separated, e.g., "5,6")
#[arg(long)]
pub outputs: Option<String>,
/// True sentence indices for MinimumAxiomSet (comma-separated, e.g., "0,1,2,3,4,5,6,7")
#[arg(long)]
pub true_sentences: Option<String>,
/// Implications for MinimumAxiomSet (semicolon-separated "antecedents>consequent", e.g., "0>2;0>3;1>4;2,4>6")
#[arg(long)]
pub implications: Option<String>,
/// Loop length N for MinimumRegisterSufficiencyForLoops
#[arg(long)]
pub loop_length: Option<usize>,
/// Variables as semicolon-separated start,duration pairs for MinimumRegisterSufficiencyForLoops (e.g., "0,3;2,3;4,3")
#[arg(long)]
pub loop_variables: Option<String>,
/// Parallel assignments for MinimumCodeGenerationParallelAssignments (semicolon-separated "target:read1,read2" entries, e.g., "0:1,2;1:0;2:3;3:1,2")
#[arg(long)]
pub assignments: Option<String>,
/// Number of variables for MinimumCodeGenerationParallelAssignments
#[arg(long)]
pub num_variables: Option<usize>,
/// Truth table for MinimumDisjunctiveNormalForm (comma-separated 0/1, e.g., "0,1,1,1,1,1,1,0")
#[arg(long)]
pub truth_table: Option<String>,
/// Test matrix for MinimumDecisionTree (JSON 2D bool array, e.g., '[[true,true,false],[true,false,false]]')
#[arg(long)]
pub test_matrix: Option<String>,
/// Number of tests for MinimumDecisionTree
#[arg(long)]
pub num_tests: Option<usize>,
/// Tiles for SquareTiling (semicolon-separated top,right,bottom,left tuples, e.g., "0,1,2,0;0,0,2,1;2,1,0,0;2,0,0,1")
#[arg(long)]
pub tiles: Option<String>,
/// Grid size N for SquareTiling (N x N grid)
#[arg(long)]
pub grid_size: Option<usize>,
/// Number of colors for SquareTiling
#[arg(long)]
pub num_colors: Option<usize>,
}
impl CreateArgs {
#[allow(dead_code)]
pub fn flag_map(&self) -> HashMap<&'static str, Option<String>> {
let mut flags = HashMap::new();
macro_rules! insert {
($key:literal, $expr:expr) => {
flags.insert($key, ($expr).map(|value| value.to_string()));
};
}
insert!("example", self.example.as_deref());
insert!("to", self.example_target.as_deref());
insert!("graph", self.graph.as_deref());
insert!("weights", self.weights.as_deref());
insert!("edge-weights", self.edge_weights.as_deref());
insert!("edge-lengths", self.edge_lengths.as_deref());
insert!("capacities", self.capacities.as_deref());
insert!("demands", self.demands.as_deref());
insert!("setup-costs", self.setup_costs.as_deref());
insert!("production-costs", self.production_costs.as_deref());
insert!("inventory-costs", self.inventory_costs.as_deref());
insert!("bundle-capacities", self.bundle_capacities.as_deref());
insert!("cost-matrix", self.cost_matrix.as_deref());
insert!("delay-matrix", self.delay_matrix.as_deref());
insert!("lower-bounds", self.lower_bounds.as_deref());
insert!("multipliers", self.multipliers.as_deref());
insert!("sink", self.sink);
insert!("requirement", self.requirement);
insert!("num-paths-required", self.num_paths_required);
insert!("paths", self.paths.as_deref());
insert!("couplings", self.couplings.as_deref());
insert!("fields", self.fields.as_deref());
insert!("clauses", self.clauses.as_deref());
insert!("disjuncts", self.disjuncts.as_deref());
insert!("num-vars", self.num_vars);
insert!("matrix", self.matrix.as_deref());
insert!("k", self.k);
insert!("num-partitions", self.num_partitions);
flags.insert("random", self.random.then(|| "true".to_string()));
insert!("num-vertices", self.num_vertices);
insert!("source-vertex", self.source_vertex);
insert!("target-vertex", self.target_vertex);
insert!("edge-prob", self.edge_prob);
insert!("seed", self.seed);
insert!("target", self.target.as_deref());
insert!("m", self.m);
insert!("n", self.n);
insert!("positions", self.positions.as_deref());
insert!("radius", self.radius);
insert!("source-1", self.source_1);
insert!("sink-1", self.sink_1);
insert!("source-2", self.source_2);
insert!("sink-2", self.sink_2);
insert!("requirement-1", self.requirement_1);
insert!("requirement-2", self.requirement_2);
insert!("sizes", self.sizes.as_deref());
insert!("probabilities", self.probabilities.as_deref());
insert!("capacity", self.capacity.as_deref());
insert!("sequence", self.sequence.as_deref());
insert!("subsets", self.sets.as_deref());
insert!("r-sets", self.r_sets.as_deref());
insert!("s-sets", self.s_sets.as_deref());
insert!("r-weights", self.r_weights.as_deref());
insert!("s-weights", self.s_weights.as_deref());
insert!("partition", self.partition.as_deref());
insert!("partitions", self.partitions.as_deref());
insert!("bundles", self.bundles.as_deref());
insert!("universe-size", self.universe);
insert!("universe", self.universe); // PrimeAttributeName maps num_attributes → --universe
insert!("biedges", self.biedges.as_deref());
insert!("left", self.left);
insert!("right", self.right);
insert!("rank", self.rank);
insert!("basis", self.basis.as_deref());
insert!("target-vec", self.target_vec.as_deref());
insert!("bounds", self.bounds.as_deref());
insert!("release-times", self.release_times.as_deref());
insert!("lengths", self.lengths.as_deref().or(self.sizes.as_deref()));
insert!("terminals", self.terminals.as_deref());
insert!("terminal-pairs", self.terminal_pairs.as_deref());
insert!("tree", self.tree.as_deref());
insert!("required-edges", self.required_edges.as_deref());