Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/paper/reductions.typ
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"BoundedComponentSpanningForest": [Bounded Component Spanning Forest],
"BinPacking": [Bin Packing],
"BoyceCoddNormalFormViolation": [Boyce-Codd Normal Form Violation],
"CapacityAssignment": [Capacity Assignment],
"ConsistencyOfDatabaseFrequencyTables": [Consistency of Database Frequency Tables],
"ClosestVectorProblem": [Closest Vector Problem],
"ConsecutiveSets": [Consecutive Sets],
Expand Down Expand Up @@ -5052,6 +5053,39 @@ A classical NP-complete problem from Garey and Johnson @garey1979[Ch.~3, p.~76],
]
}

#{
let x = load-model-example("CapacityAssignment")
[
#problem-def("CapacityAssignment")[
Given a finite set $C$ of communication links, an ordered set $M subset ZZ_(> 0)$ of capacities, cost and delay functions $g: C times M -> ZZ_(>= 0)$ and $d: C times M -> ZZ_(>= 0)$ such that for every $c in C$ and $i < j$ in the order of $M$ we have $g(c, i) <= g(c, j)$ and $d(c, i) >= d(c, j)$, and budgets $K, J in ZZ_(>= 0)$, determine whether there exists an assignment $sigma: C -> M$ such that $sum_(c in C) g(c, sigma(c)) <= K$ and $sum_(c in C) d(c, sigma(c)) <= J$.
][
Capacity Assignment is the bicriteria communication-network design problem SR7 in Garey & Johnson @garey1979. The original NP-completeness proof, via reduction from Subset Sum, is due to Van Sickle and Chandy @vansicklechandy1977. The model captures discrete provisioning of communication links, where upgrading a link increases installation cost but decreases delay. The direct witness encoding implemented in this repository yields an $O^*(|M|^(|C|))$ exact algorithm by brute-force enumeration#footnote[No algorithm improving on brute-force enumeration is known for the exact witness encoding used in this repository.]. Garey and Johnson also note a pseudo-polynomial dynamic-programming formulation when the budgets are small @garey1979.

*Example.* Let $C = {c_1, c_2, c_3}$, $M = {1, 2, 3}$, $K = 10$, and $J = 12$. With cost rows $(1, 3, 6)$, $(2, 4, 7)$, $(1, 2, 5)$ and delay rows $(8, 4, 1)$, $(7, 3, 1)$, $(6, 3, 1)$, the assignment $sigma = (2, 2, 2)$ has total cost $3 + 4 + 2 = 9 <= 10$ and total delay $4 + 3 + 3 = 10 <= 12$, so the instance is satisfiable. Brute-force enumeration finds exactly 5 satisfying assignments; for contrast, $sigma = (1, 1, 1)$ violates the delay budget and $sigma = (3, 3, 3)$ violates the cost budget.

#pred-commands(
"pred create --example " + problem-spec(x) + " -o capacity-assignment.json",
"pred solve capacity-assignment.json --solver brute-force",
"pred evaluate capacity-assignment.json --config " + x.optimal_config.map(str).join(","),
)

#figure({
table(
columns: (auto, auto, auto),
inset: 4pt,
align: left,
table.header([*Link*], [*Cost row*], [*Delay row*]),
[$c_1$], [$(1, 3, 6)$], [$(8, 4, 1)$],
[$c_2$], [$(2, 4, 7)$], [$(7, 3, 1)$],
[$c_3$], [$(1, 2, 5)$], [$(6, 3, 1)$],
)
},
caption: [Canonical Capacity Assignment instance with budgets $K = 10$ and $J = 12$. Each row lists the cost-delay trade-off for one communication link.],
) <fig:capacity-assignment>
]
]
}

#{
let x = load-model-example("PrecedenceConstrainedScheduling")
let n = x.instance.num_tasks
Expand Down
8 changes: 8 additions & 0 deletions docs/paper/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ @article{robertsonSeymour1995
doi = {10.1006/jctb.1995.1006}
}

@inproceedings{vansicklechandy1977,
author = {Lawrence Van Sickle and K. Mani Chandy},
title = {Computational Complexity of Network Design Algorithms},
booktitle = {IFIP Congress 77},
pages = {235--239},
year = {1977}
}

@article{bruckerGareyJohnson1977,
author = {Peter Brucker and Michael R. Garey and David S. Johnson},
title = {Scheduling equal-length tasks under tree-like precedence constraints to minimize maximum lateness},
Expand Down
22 changes: 18 additions & 4 deletions problemreductions-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ Flags by problem type:
PathConstrainedNetworkFlow --arcs, --capacities, --source, --sink, --paths, --requirement
Factoring --target, --m, --n
BinPacking --sizes, --capacity
CapacityAssignment --capacities, --cost-matrix, --delay-matrix, --cost-budget, --delay-budget
SubsetSum --sizes, --target
SumOfSquaresPartition --sizes, --num-groups, --bound
PaintShop --sequence
Expand Down Expand Up @@ -321,6 +322,7 @@ Examples:
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 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 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
Expand Down Expand Up @@ -366,15 +368,21 @@ pub struct CreateArgs {
/// Edge lengths (e.g., 2,3,1) [default: all 1s]
#[arg(long)]
pub edge_lengths: Option<String>,
/// Edge capacities for multicommodity flow problems (e.g., 1,1,2)
/// Capacities (edge capacities for flow problems, capacity levels for CapacityAssignment)
#[arg(long)]
pub capacities: 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>,
/// 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>,
Expand Down Expand Up @@ -547,6 +555,12 @@ pub struct CreateArgs {
/// Upper bound on total inter-partition arc cost
#[arg(long)]
pub cost_bound: Option<i32>,
/// Budget on total cost for CapacityAssignment
#[arg(long)]
pub cost_budget: Option<u64>,
/// 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>,
Expand Down
Loading
Loading