Libraryless. Click here for Pure Java version (4991L/29K).
1 | svoid test_ProbabilisticDistanceBasedLookup() { |
2 | new L<WithProbability<Double>> out; |
3 | new ProbabilisticScheduler scheduler; |
4 | NavigableMap<Double> map = listToKeyAndValue_treeMap(ll( |
5 | 1.0, 2.0, 3.0, 4.0, 5.0 |
6 | )); |
7 | |
8 | ProbabilisticDistanceBasedLookup lookup = new(scheduler, map, |
9 | x -> out.add(withProbability(scheduler.current(), x)), |
10 | 3.5); |
11 | lookup.run(); |
12 | scheduler.run(50); |
13 | |
14 | assertEqualsVerbose(str(out), str(ll( |
15 | withProbability(.67, 3.0), |
16 | withProbability(.67, 4.0), |
17 | withProbability(.4, 2.0), |
18 | withProbability(.4, 5.0), |
19 | withProbability(.29, 1.0)))); |
20 | } |
Began life as a copy of #1031997
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1031999 |
Snippet name: | test_ProbabilisticDistanceBasedLookup (OK) |
Eternal ID of this version: | #1031999/2 |
Text MD5: | 0fb650f07b52fe9b40512a1ffd20da30 |
Transpilation MD5: | eb406aa206dc183d52b2577a93fb7020 |
Author: | stefan |
Category: | javax / probabilistic computing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-08 15:35:49 |
Source code size: | 612 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 160 / 226 |
Version history: | 1 change(s) |
Referenced in: | [show references] |