From 610212081ac6b1b101d25107e248e8129f1b3f2e Mon Sep 17 00:00:00 2001 From: FiveMovesAhead Date: Tue, 6 May 2025 21:34:39 +0100 Subject: [PATCH] Add missing imports for hypergraph. --- tig-algorithms/src/lib.rs | 4 ++++ tig-challenges/src/hypergraph.rs | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/tig-algorithms/src/lib.rs b/tig-algorithms/src/lib.rs index e0aaefb..b0cb6d9 100644 --- a/tig-algorithms/src/lib.rs +++ b/tig-algorithms/src/lib.rs @@ -9,3 +9,7 @@ pub use vehicle_routing as c002; pub mod vector_search; #[cfg(feature = "cuda")] pub use vector_search as c004; +#[cfg(feature = "cuda")] +pub mod hypergraph; +#[cfg(feature = "cuda")] +pub use hypergraph as c005; diff --git a/tig-challenges/src/hypergraph.rs b/tig-challenges/src/hypergraph.rs index b5423cd..25be603 100644 --- a/tig-challenges/src/hypergraph.rs +++ b/tig-challenges/src/hypergraph.rs @@ -12,6 +12,20 @@ pub struct Difficulty { pub better_than_baseline: u32, } +impl From> for Difficulty { + fn from(arr: Vec) -> Self { + Self { + num_hyperedges: arr[0] as u32, + better_than_baseline: arr[1] as u32, + } + } +} +impl Into> for Difficulty { + fn into(self) -> Vec { + vec![self.num_hyperedges as i32, self.better_than_baseline as i32] + } +} + #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Solution { pub sub_solutions: Vec,