ReduceTo

Trait ReduceTo 

Source
pub trait ReduceTo<T: Problem>: Problem {
    type Result: ReductionResult<Source = Self, Target = T>;

    // Required method
    fn reduce_to(&self) -> Self::Result;
}
Expand description

Trait for problems that can be reduced to target type T.

§Example

// Example showing reduction workflow
use problemreductions::prelude::*;
use problemreductions::rules::ReduceTo;

let sat_problem: Satisfiability = Satisfiability::new(
    3,  // 3 variables
    vec![
        CNFClause::new(vec![0, 1]),     // (x0 OR x1)
        CNFClause::new(vec![1, 2]),     // (x1 OR x2)
    ]
);

// Reduce to Independent Set
let reduction = sat_problem.reduce_to();
let is_problem = reduction.target_problem();

// Solve and extract solutions
let solver = BruteForce::new();
let solutions = solver.find_all_best(is_problem);
let sat_solutions: Vec<_> = solutions.iter()
    .map(|s| reduction.extract_solution(s))
    .collect();

Required Associated Types§

Source

type Result: ReductionResult<Source = Self, Target = T>

The reduction result type.

Required Methods§

Source

fn reduce_to(&self) -> Self::Result

Reduce this problem to the target problem type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl ReduceTo<ILP> for QUBO<f64>

Source§

type Result = ReductionQUBOToILP

Source§

impl ReduceTo<ILP> for CircuitSAT

Source§

type Result = ReductionCircuitToILP

Source§

impl ReduceTo<ILP> for KColoring<K1, SimpleGraph>

Source§

type Result = ReductionKColoringToILP<K1, SimpleGraph>

Source§

impl ReduceTo<ILP> for KColoring<K2, SimpleGraph>

Source§

type Result = ReductionKColoringToILP<K2, SimpleGraph>

Source§

impl ReduceTo<ILP> for KColoring<K3, SimpleGraph>

Source§

type Result = ReductionKColoringToILP<K3, SimpleGraph>

Source§

impl ReduceTo<ILP> for KColoring<K4, SimpleGraph>

Source§

type Result = ReductionKColoringToILP<K4, SimpleGraph>

Source§

impl ReduceTo<ILP> for KColoring<KN, SimpleGraph>

Source§

type Result = ReductionKColoringToILP<KN, SimpleGraph>

Source§

impl ReduceTo<ILP> for MaximumClique<SimpleGraph, i32>

Source§

type Result = ReductionCliqueToILP

Source§

impl ReduceTo<ILP> for MaximumMatching<SimpleGraph, i32>

Source§

type Result = ReductionMatchingToILP

Source§

impl ReduceTo<ILP> for MinimumDominatingSet<SimpleGraph, i32>

Source§

type Result = ReductionDSToILP

Source§

impl ReduceTo<ILP> for TravelingSalesman<SimpleGraph, i32>

Source§

type Result = ReductionTSPToILP

Source§

impl ReduceTo<ILP> for BinPacking<i32>

Source§

type Result = ReductionBPToILP

Source§

impl ReduceTo<ILP> for MaximumSetPacking<i32>

Source§

type Result = ReductionSPToILP

Source§

impl ReduceTo<ILP> for MinimumSetCovering<i32>

Source§

type Result = ReductionSCToILP

Source§

impl ReduceTo<ILP<i32>> for ILP<bool>

Source§

type Result = ReductionBinaryILPToIntILP

Source§

impl ReduceTo<ILP<i32>> for Factoring

Source§

type Result = ReductionFactoringToILP

Source§

impl ReduceTo<QUBO> for ILP<bool>

Source§

type Result = ReductionILPToQUBO

Source§

impl ReduceTo<QUBO> for KSatisfiability<K2>

Source§

type Result = ReductionKSatToQUBO

Source§

impl ReduceTo<QUBO> for KSatisfiability<K3>

Source§

type Result = Reduction3SATToQUBO

Source§

impl ReduceTo<QUBO> for KColoring<K2, SimpleGraph>

Source§

type Result = ReductionKColoringToQUBO<K2>

Source§

impl ReduceTo<QUBO> for KColoring<K3, SimpleGraph>

Source§

type Result = ReductionKColoringToQUBO<K3>

Source§

impl ReduceTo<QUBO> for KColoring<KN, SimpleGraph>

Source§

type Result = ReductionKColoringToQUBO<KN>

Source§

impl ReduceTo<QUBO> for SpinGlass<SimpleGraph, f64>

Source§

type Result = ReductionSGToQUBO

Source§

impl ReduceTo<QUBO> for MaximumSetPacking<f64>

Source§

type Result = ReductionSPToQUBO

Source§

impl ReduceTo<CircuitSAT> for Satisfiability

Source§

type Result = ReductionSATToCircuit

Source§

impl ReduceTo<CircuitSAT> for Factoring

Source§

type Result = ReductionFactoringToCircuit

Source§

impl ReduceTo<KSatisfiability<K3>> for Satisfiability

Source§

type Result = ReductionSATToKSAT<K3>

Source§

impl ReduceTo<KSatisfiability<KN>> for KSatisfiability<K2>

Source§

impl ReduceTo<KSatisfiability<KN>> for KSatisfiability<K3>

Source§

impl ReduceTo<Satisfiability> for KSatisfiability<K2>

Source§

type Result = ReductionKSATToSAT<K2>

Source§

impl ReduceTo<Satisfiability> for KSatisfiability<K3>

Source§

type Result = ReductionKSATToSAT<K3>

Source§

impl ReduceTo<Satisfiability> for KSatisfiability<KN>

Source§

type Result = ReductionKSATToSAT<KN>

Source§

impl ReduceTo<KColoring<K3, SimpleGraph>> for Satisfiability

Source§

type Result = ReductionSATToColoring

Source§

impl ReduceTo<KColoring<KN, SimpleGraph>> for KColoring<K3, SimpleGraph>

Source§

impl ReduceTo<MaxCut<SimpleGraph, i32>> for SpinGlass<SimpleGraph, i32>

Source§

type Result = ReductionSGToMaxCut<i32>

Source§

impl ReduceTo<MaximumClique<SimpleGraph, i32>> for MaximumIndependentSet<SimpleGraph, i32>

Source§

type Result = ReductionISToClique<i32>

Source§

impl ReduceTo<MaximumIndependentSet<KingsSubgraph, i32>> for MaximumIndependentSet<KingsSubgraph, One>

Source§

impl ReduceTo<MaximumIndependentSet<KingsSubgraph, One>> for MaximumIndependentSet<SimpleGraph, One>

Source§

type Result = ReductionISSimpleOneToGridOne

Source§

impl ReduceTo<MaximumIndependentSet<SimpleGraph, i32>> for MaximumIndependentSet<SimpleGraph, One>

Source§

impl ReduceTo<MaximumIndependentSet<SimpleGraph, i32>> for MaximumIndependentSet<UnitDiskGraph, i32>

Source§

impl ReduceTo<MaximumIndependentSet<SimpleGraph, i32>> for MinimumVertexCover<SimpleGraph, i32>

Source§

type Result = ReductionVCToIS<i32>

Source§

impl ReduceTo<MaximumIndependentSet<SimpleGraph, i32>> for MaximumSetPacking<i32>

Source§

type Result = ReductionSPToIS<i32>

Source§

impl ReduceTo<MaximumIndependentSet<SimpleGraph, One>> for Satisfiability

Source§

type Result = ReductionSATToIS

Source§

impl ReduceTo<MaximumIndependentSet<SimpleGraph, One>> for MaximumIndependentSet<UnitDiskGraph, One>

Source§

impl ReduceTo<MaximumIndependentSet<SimpleGraph, One>> for MaximumSetPacking<One>

Source§

type Result = ReductionSPToIS<One>

Source§

impl ReduceTo<MaximumIndependentSet<TriangularSubgraph, i32>> for MaximumIndependentSet<SimpleGraph, One>

Source§

type Result = ReductionISSimpleToTriangular

Source§

impl ReduceTo<MaximumIndependentSet<UnitDiskGraph, i32>> for MaximumIndependentSet<KingsSubgraph, i32>

Source§

impl ReduceTo<MaximumIndependentSet<UnitDiskGraph, i32>> for MaximumIndependentSet<TriangularSubgraph, i32>

Source§

impl ReduceTo<MaximumIndependentSet<UnitDiskGraph, i32>> for MaximumIndependentSet<UnitDiskGraph, One>

Source§

impl ReduceTo<MaximumIndependentSet<UnitDiskGraph, One>> for MaximumIndependentSet<KingsSubgraph, One>

Source§

impl ReduceTo<MinimumDominatingSet<SimpleGraph, i32>> for Satisfiability

Source§

type Result = ReductionSATToDS

Source§

impl ReduceTo<MinimumVertexCover<SimpleGraph, i32>> for MaximumIndependentSet<SimpleGraph, i32>

Source§

type Result = ReductionISToVC<i32>

Source§

impl ReduceTo<SpinGlass<SimpleGraph, f64>> for QUBO<f64>

Source§

type Result = ReductionQUBOToSG

Source§

impl ReduceTo<SpinGlass<SimpleGraph, f64>> for SpinGlass<SimpleGraph, i32>

Source§

impl ReduceTo<SpinGlass<SimpleGraph, i32>> for CircuitSAT

Source§

type Result = ReductionCircuitToSG

Source§

impl ReduceTo<SpinGlass<SimpleGraph, i32>> for MaxCut<SimpleGraph, i32>

Source§

type Result = ReductionMaxCutToSG<i32>

Source§

impl ReduceTo<SubsetSum> for KSatisfiability<K3>

Source§

type Result = Reduction3SATToSubsetSum

Source§

impl ReduceTo<MaximumSetPacking> for MaximumIndependentSet<SimpleGraph, i32>

Source§

type Result = ReductionISToSP<i32>

Source§

impl ReduceTo<MaximumSetPacking> for MaximumMatching<SimpleGraph, i32>

Source§

type Result = ReductionMatchingToSP<SimpleGraph, i32>

Source§

impl ReduceTo<MaximumSetPacking> for MaximumSetPacking<One>

Source§

impl ReduceTo<MaximumSetPacking<f64>> for MaximumSetPacking<i32>

Source§

impl ReduceTo<MaximumSetPacking<One>> for MaximumIndependentSet<SimpleGraph, One>

Source§

type Result = ReductionISToSP<One>

Source§

impl ReduceTo<MinimumSetCovering> for MinimumVertexCover<SimpleGraph, i32>

Source§

type Result = ReductionVCToSC<i32>