wip: heuristics engine

This commit is contained in:
Jonathan Kelley committed 2021-07-15 04:17:45 -04:00
1 parent 00231adfa2
commit 6aaad1c9ef
3 files changed
+46

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
use std::collections::HashMap;
use crate::FC;
pub(crate) struct HeuristicsEngine {
heuristics: HashMap<FcSlot, Heuristic>,
}
pub(crate) type FcSlot = *const ();
pub(crate) struct Heuristic {
hooks: u32,
bump_size: u64,
}
impl HeuristicsEngine {
pub(crate) fn new() -> Self {
Self {
heuristics: HashMap::new(),
}
}
fn recommend<T>(&mut self, fc: FC<T>, heuristic: Heuristic) {
let g = fc as FcSlot;
let e = self.heuristics.entry(g);
}
fn get_recommendation<T>(&mut self, fc: FC<T>) -> &Heuristic {
let id = fc as FcSlot;
self.heuristics.entry(id).or_insert(Heuristic {
bump_size: 100,
hooks: 10,
})
}
}
#[test]
fn types_work() {
let engine = HeuristicsEngine::new();
}