Skip to content

Commit 368559f

Browse files
committed
update
1 parent 4069b52 commit 368559f

3 files changed

Lines changed: 0 additions & 71 deletions

File tree

src/rules/maximumindependentset_gridgraph.rs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -55,51 +55,6 @@ impl ReduceTo<MaximumIndependentSet<KingsSubgraph, One>>
5555
}
5656
}
5757

58-
/// Result of reducing MIS<SimpleGraph, One> to MIS<KingsSubgraph, i32>.
59-
#[derive(Debug, Clone)]
60-
pub struct ReductionISSimpleOneToGridWeighted {
61-
target: MaximumIndependentSet<KingsSubgraph, i32>,
62-
mapping_result: ksg::MappingResult<ksg::KsgTapeEntry>,
63-
}
64-
65-
impl ReductionResult for ReductionISSimpleOneToGridWeighted {
66-
type Source = MaximumIndependentSet<SimpleGraph, One>;
67-
type Target = MaximumIndependentSet<KingsSubgraph, i32>;
68-
69-
fn target_problem(&self) -> &Self::Target {
70-
&self.target
71-
}
72-
73-
fn extract_solution(&self, target_solution: &[usize]) -> Vec<usize> {
74-
self.mapping_result.map_config_back(target_solution)
75-
}
76-
}
77-
78-
#[reduction(
79-
overhead = {
80-
num_vertices = "num_vertices * num_vertices",
81-
num_edges = "num_vertices * num_vertices",
82-
}
83-
)]
84-
impl ReduceTo<MaximumIndependentSet<KingsSubgraph, i32>>
85-
for MaximumIndependentSet<SimpleGraph, One>
86-
{
87-
type Result = ReductionISSimpleOneToGridWeighted;
88-
89-
fn reduce_to(&self) -> Self::Result {
90-
let n = self.graph().num_vertices();
91-
let edges = self.graph().edges();
92-
let result = ksg::map_unweighted(n, &edges);
93-
let weights = result.node_weights.clone();
94-
let grid = result.to_kings_subgraph();
95-
let target = MaximumIndependentSet::new(grid, weights);
96-
ReductionISSimpleOneToGridWeighted {
97-
target,
98-
mapping_result: result,
99-
}
100-
}
101-
}
102-
10358
#[cfg(test)]
10459
#[path = "../unit_tests/rules/maximumindependentset_gridgraph.rs"]
10560
mod tests;

src/unit_tests/rules/analysis.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,6 @@ fn test_find_dominated_rules_returns_known_set() {
254254
("Factoring", "ILP {variable: \"i32\"}"),
255255
// K3-SAT → QUBO via SAT → CircuitSAT → SpinGlass chain
256256
("KSatisfiability {k: \"K3\"}", "QUBO {weight: \"f64\"}"),
257-
// Variant cast composed: SimpleGraph/One → KingsSubgraph/One → KingsSubgraph/i32
258-
(
259-
"MaximumIndependentSet {graph: \"SimpleGraph\", weight: \"One\"}",
260-
"MaximumIndependentSet {graph: \"KingsSubgraph\", weight: \"i32\"}",
261-
),
262257
// MaxMatching → MaxSetPacking → ILP is better than direct MaxMatching → ILP
263258
(
264259
"MaximumMatching {graph: \"SimpleGraph\", weight: \"i32\"}",

src/unit_tests/rules/maximumindependentset_gridgraph.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,3 @@ fn test_mis_simple_one_to_kings_one_closed_loop() {
5252
let size: usize = original_solution.iter().sum();
5353
assert_eq!(size, 3, "Max IS in path of 5 should be 3");
5454
}
55-
56-
#[test]
57-
fn test_mis_simple_one_to_kings_weighted_closed_loop() {
58-
// Path graph: 0-1-2-3-4 (MIS = 3: select vertices 0, 2, 4)
59-
let problem = MaximumIndependentSet::new(
60-
SimpleGraph::new(5, vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
61-
vec![One; 5],
62-
);
63-
let result = ReduceTo::<MaximumIndependentSet<KingsSubgraph, i32>>::reduce_to(&problem);
64-
let target = result.target_problem();
65-
assert!(target.graph().num_vertices() > 5);
66-
67-
let solver = BruteForce::new();
68-
let grid_solutions = solver.find_all_best(target);
69-
assert!(!grid_solutions.is_empty());
70-
71-
let original_solution = result.extract_solution(&grid_solutions[0]);
72-
assert_eq!(original_solution.len(), 5);
73-
let size: usize = original_solution.iter().sum();
74-
assert_eq!(size, 3, "Max IS in path of 5 should be 3");
75-
}

0 commit comments

Comments
 (0)