i suspect state isnt resetting enough* with test.sh

master
Bel LaPointe 2022-04-11 12:03:20 -06:00
parent 00403d03a2
commit 51db4406fd
2 changed files with 14 additions and 6 deletions

View File

@ -31,12 +31,12 @@ def with_(N, M, R, T, p):
while True:
got = readline()
if not got:
[buckets[i].pop() for i in buckets]
else:
if got:
if not got in buckets:
buckets[got] = Bucket(N, M, R, T, cb.cb(got))
buckets[got].push()
# TODO no /state
[buckets[i].pop() for i in buckets]
def readline():
def __input(*args):
@ -84,7 +84,15 @@ class Bucket():
if new_state == self.__last_state:
return
self.__last_state = new_state
filledness = int(100*(self.q/self.M))/100.0
filledness = int(
100*(
max(
[self.q-self.T, 0]
)/max(
[self.M-self.T, 1]
)
)
)/100.0
if filledness > 1.0:
filledness = 1.0
self.CB(State(new_state, filledness))

View File

@ -21,11 +21,11 @@ python3 ./testdata/rand_0_n_stream.py \
-b-min 1 \
-b-max 10 \
-d-min 100 \
-d-max 2000 \
-d-max 3000 \
-between 100 \
| peek \
| python3 ./stream_to_state.py \
-n 20 \
-m 15 \
-r 15 \
-t 14
-t 15