Commit 73ec8d2 1 parent af8be83 commit 73ec8d2 Copy full SHA for 73ec8d2
File tree 4 files changed +25
-9
lines changed
4 files changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -174,9 +174,9 @@ impl std::fmt::Display for Abstraction {
174
174
impl Arbitrary for Abstraction {
175
175
fn random ( ) -> Self {
176
176
use rand:: Rng ;
177
- let street = Street :: random ( ) ;
178
- let n = street. k ( ) ;
179
- let i = rand:: thread_rng ( ) . gen_range ( 0 ..n ) ;
177
+ let street = Street :: Flop ;
178
+ let k = street. k ( ) ;
179
+ let i = rand:: thread_rng ( ) . gen_range ( 0 ..k ) ;
180
180
Abstraction :: from ( ( street, i) )
181
181
}
182
182
}
Original file line number Diff line number Diff line change @@ -51,6 +51,17 @@ impl Metric {
51
51
/// entreis in our abstraction pair lookup table.
52
52
/// if this is off by just a few then it probably means a bunch of collisions
53
53
/// maybe i should determinsitcally seed kmeans process, could be cool for reproducability too
54
+ ///
55
+ /// TODO
56
+ ///
57
+ /// determine street dynamiccaly by checking for existence of XOR'ed abstraction pairs using
58
+ /// Abstraction::From(Street, Index)
59
+ ///
60
+ /// it's also not great that we are FORCED to have different number of abstractions
61
+ /// clusters K means for each street to avoid nC2 collisions !!
62
+ /// we should either just store Street as Self.1 or determine from XOR hits what street we're on
63
+ /// whichever solution should work with test case so we don't have to remove test case
64
+ /// to not overwrite existing metric. we like overwriting river.metric bc it can be empty
54
65
fn street ( & self ) -> Street {
55
66
fn choose_2 ( k : usize ) -> usize {
56
67
k * ( k. saturating_sub ( 1 ) ) / 2
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ impl Arbitrary for Path {
15
15
/// we (un)pack the byte representation of the edges in a Path(u64) sequence
16
16
impl From < Path > for Vec < Edge > {
17
17
fn from ( path : Path ) -> Self {
18
- ( 0 ..)
18
+ ( 0 ..16 )
19
19
. map ( |i| i * 4 )
20
20
. map ( |b| 0xF & ( path. 0 >> b) )
21
21
. map ( |bits| bits as u8 )
@@ -69,18 +69,17 @@ mod tests {
69
69
#[ test]
70
70
fn bijective_path_empty ( ) {
71
71
let edges = vec ! [ ] ;
72
- let round = Vec :: < Edge > :: from ( Path :: from ( edges. clone ( ) ) ) ;
73
- assert_eq ! ( edges, round ) ;
72
+ let paths = Vec :: < Edge > :: from ( Path :: from ( edges. clone ( ) ) ) ;
73
+ assert_eq ! ( edges, paths ) ;
74
74
}
75
75
76
76
#[ test]
77
77
fn bijective_path_edges ( ) {
78
78
let edges = ( 0 ..)
79
79
. map ( |_| Edge :: random ( ) )
80
- . filter ( |e| e. is_choice ( ) )
81
80
. take ( 16 )
82
81
. collect :: < Vec < Edge > > ( ) ;
83
- let round = Vec :: < Edge > :: from ( Path :: from ( edges. clone ( ) ) ) ;
84
- assert_eq ! ( edges, round ) ;
82
+ let paths = Vec :: < Edge > :: from ( Path :: from ( edges. clone ( ) ) ) ;
83
+ assert_eq ! ( edges, paths ) ;
85
84
}
86
85
}
Original file line number Diff line number Diff line change @@ -568,6 +568,7 @@ impl std::fmt::Display for Profile {
568
568
)
569
569
}
570
570
}
571
+
571
572
#[ cfg( test) ]
572
573
mod tests {
573
574
use super :: * ;
@@ -576,6 +577,11 @@ mod tests {
576
577
use crate :: Save ;
577
578
578
579
#[ test]
580
+ #[ ignore]
581
+ /// we don't run this test because we don't want to overwrite
582
+ /// an existing blueprint profile, and we no longer use any
583
+ /// arguments to the save function to write to a temporary name
584
+ /// and delete the file
579
585
fn persistence ( ) {
580
586
let name = "test" ;
581
587
let file = format ! ( "{}.profile.pgcopy" , name) ;
You can’t perform that action at this time.
0 commit comments