From acb799765d975601ae25c43ca2bec9636030aa38 Mon Sep 17 00:00:00 2001 From: MarcoBackman Date: Wed, 29 Sep 2021 16:56:54 -0400 Subject: [PATCH] Fully implemented KNN algorithm --- data/SMALL_DATA_CASE2_10 | 38 +- data/SMALL_DATA_CASE3_20 | 78 +- data/SMALL_DATA_CASE4_30 | 152 +- data/SMALL_DATA_CASE5_40 | 306 +-- data/SMALL_DATA_CASE6_50 | 620 +++--- data/SMALL_DATA_CASE7_60 | 1238 ++++++------ data/SMALL_DATA_CASE8_70 | 2500 ++++++++++++------------- src/Main.java | 17 +- src/datastructure/DataCarrier.java | 24 +- src/datastructure/KDTreeIntegers.java | 105 +- src/utils/CoordinateReader.java | 2 - 11 files changed, 2591 insertions(+), 2489 deletions(-) diff --git a/data/SMALL_DATA_CASE2_10 b/data/SMALL_DATA_CASE2_10 index 2cfad88..24f59f0 100644 --- a/data/SMALL_DATA_CASE2_10 +++ b/data/SMALL_DATA_CASE2_10 @@ -1,20 +1,20 @@ -6 7 -2 4 -4 8 -5 7 -6 7 -2 9 +1 8 +4 9 +4 7 +7 7 +5 9 +3 5 +1 4 +9 7 +5 4 +4 3 2 2 -3 9 -7 8 -8 1 -9 3 -1 5 -4 8 -8 8 -6 6 -9 9 -3 1 -5 5 -2 5 -6 9 +9 4 +9 8 +8 5 +9 5 +7 2 +2 7 +9 1 +1 9 +3 8 diff --git a/data/SMALL_DATA_CASE3_20 b/data/SMALL_DATA_CASE3_20 index a3c335d..42c3b0c 100644 --- a/data/SMALL_DATA_CASE3_20 +++ b/data/SMALL_DATA_CASE3_20 @@ -1,40 +1,40 @@ -8 15 -9 8 -8 9 -10 12 -14 11 -18 3 -4 6 -16 18 -9 19 -16 16 -8 18 -4 3 -6 18 -13 5 -19 4 -5 15 -10 16 -11 6 -3 14 -12 4 -12 5 -6 19 -5 19 -11 10 -16 9 -2 4 -18 11 -12 12 -1 7 -11 14 -9 15 -11 4 -6 3 +5 1 +17 9 +4 4 +12 16 +6 16 +18 13 +7 9 +11 1 10 13 -18 7 -6 12 -15 10 -11 4 -9 7 -17 3 +13 1 +2 2 +2 7 +4 2 +3 19 +18 9 +18 17 +6 14 +12 3 +13 18 +9 2 +17 19 +19 5 +7 7 +14 6 +19 13 +4 11 +16 18 +8 19 +6 1 +4 2 +8 16 +10 4 +10 18 +15 7 +15 3 +1 10 +8 5 +12 18 +12 17 +14 16 diff --git a/data/SMALL_DATA_CASE4_30 b/data/SMALL_DATA_CASE4_30 index 54a9cde..9e372c1 100644 --- a/data/SMALL_DATA_CASE4_30 +++ b/data/SMALL_DATA_CASE4_30 @@ -1,80 +1,80 @@ -26 5 +15 2 +17 20 +3 11 +20 14 23 14 -12 12 -23 15 -28 18 -4 27 -12 7 -10 13 -26 7 -29 13 -10 23 -3 28 -3 7 -4 23 -5 25 -5 17 -10 15 -4 24 -22 3 -26 14 -22 7 -28 23 -23 10 -19 23 -13 7 -7 20 -22 28 -9 28 -15 24 -6 15 -1 21 -28 24 -27 18 -22 25 -4 6 +23 21 +26 3 +4 13 +18 18 +2 9 +1 20 +2 2 +2 21 +16 3 17 27 -8 15 -3 9 -12 13 -1 26 -19 22 -10 3 -19 22 -19 3 -22 23 -13 28 -15 12 -24 27 -22 15 +3 22 +3 25 +24 23 +10 28 +23 7 22 24 -24 5 -25 19 -7 24 -8 5 -27 14 -21 29 -15 20 -17 26 -22 27 -15 19 -17 15 -20 7 -11 7 -3 29 +3 26 +8 13 +29 20 +17 16 +1 5 +7 10 +29 15 +11 22 +10 27 +3 25 +10 16 +12 28 +17 11 +4 22 +2 13 +14 12 +19 12 +28 18 +6 2 +24 14 +22 4 +11 1 +22 2 +27 2 +26 8 +25 11 +9 8 +24 3 +18 18 +23 8 +9 26 +22 3 +19 11 +19 9 +4 19 +1 17 +16 18 +3 28 +29 24 15 24 -17 1 -3 3 -12 16 -19 28 -4 1 -10 10 -6 17 -10 15 -6 18 -1 6 -5 7 -26 4 -28 24 -28 6 -4 10 +5 18 +21 16 +5 27 +26 23 +1 9 +11 4 +23 14 +9 29 +1 22 +24 25 +22 9 +4 2 +10 22 +7 8 +2 21 +5 2 +29 10 +2 8 +13 6 diff --git a/data/SMALL_DATA_CASE5_40 b/data/SMALL_DATA_CASE5_40 index 1989b9f..d6a772b 100644 --- a/data/SMALL_DATA_CASE5_40 +++ b/data/SMALL_DATA_CASE5_40 @@ -1,160 +1,160 @@ -2 16 -19 19 -25 9 -37 31 -39 32 -3 7 -20 9 -1 9 -34 24 -13 24 -11 27 -24 16 -15 37 -29 20 -5 11 -25 4 -20 26 -3 29 -1 3 -6 1 -9 6 -3 37 -39 27 -32 30 -39 4 -9 20 -18 12 -1 20 -16 31 -16 1 -35 28 -20 34 -7 25 -2 3 -18 21 -15 39 -11 35 -29 35 -8 16 25 21 -13 26 -26 33 -3 33 -14 3 -37 35 +17 32 +38 13 +33 19 +38 23 7 11 -4 31 -23 28 -37 26 -16 34 -32 18 -6 11 -29 11 -30 34 -22 26 -17 7 -10 30 -25 11 -30 34 -10 3 -37 31 -36 17 +4 12 +22 10 +13 37 +32 1 +25 26 +37 24 +36 20 +19 14 +20 32 +20 13 +24 19 +21 20 +39 26 +19 15 +22 39 +28 25 +5 23 +14 14 +29 13 +14 10 12 25 -33 18 -39 9 -27 13 -1 12 -18 14 -31 28 -21 22 -16 31 -33 13 -6 6 -15 29 -10 8 -2 23 -33 27 -22 35 -6 19 -37 6 -23 39 -24 11 -17 4 -23 39 -16 22 -5 7 -19 38 -14 32 -37 18 -20 38 -20 18 -7 33 +23 25 +11 19 +14 28 +26 25 +39 13 +33 1 +30 10 +3 14 +11 34 +14 27 +21 31 +21 39 +25 5 +34 26 19 33 -19 25 -25 39 -28 28 -10 3 -30 14 -26 31 -3 25 -29 8 -10 15 -13 10 -19 1 -34 9 -18 13 -5 37 -33 12 -2 17 -16 34 -3 37 -9 5 -4 28 -35 14 -27 22 -37 15 -35 22 -31 21 -15 37 -14 18 +27 25 +20 32 +17 36 +22 29 +24 20 +33 17 +5 33 +17 12 +36 37 +22 2 +27 4 +11 30 +12 35 +39 26 +27 19 +21 9 +13 26 +17 38 +14 3 +16 10 +30 34 +9 28 +23 10 +35 15 +24 22 +30 37 +35 34 +27 12 +8 27 +32 39 +29 6 +22 19 +26 39 +20 30 +18 2 +26 6 +8 18 +2 2 +22 21 +4 1 +36 7 +11 10 12 2 -9 31 -38 26 +24 12 +22 4 +16 23 +24 7 +15 17 +4 9 +20 6 +6 28 +39 1 +34 3 +19 9 +24 35 +14 4 +9 14 +6 11 +27 28 +39 39 +18 23 +3 10 +26 15 +1 29 +15 26 +13 36 +39 3 +28 16 +16 29 +34 20 +32 12 +14 28 +14 8 +16 11 +37 30 +10 24 +30 3 +25 4 +33 27 +16 19 +9 27 +38 21 +33 19 +26 32 +35 3 29 7 -18 18 -12 27 -32 9 -33 17 -18 1 -39 38 -2 24 -5 36 -28 23 -16 6 -30 38 -19 27 -10 2 -12 9 -4 31 -11 37 -35 5 -27 16 -23 33 +13 31 +16 10 31 17 -31 39 -3 25 -14 6 -12 33 -5 10 -16 22 -39 33 -33 14 -27 20 -35 35 -37 7 -35 19 -23 6 -8 26 -39 19 -24 13 +16 31 +32 3 +30 17 +34 39 +10 32 +38 37 +5 27 +1 29 +13 16 +16 21 +21 19 +5 32 +13 22 +10 2 +39 28 +8 33 +20 21 +5 25 +31 29 +12 15 +12 14 +7 2 +27 18 +5 6 +28 1 +39 34 +7 36 +39 28 +38 4 diff --git a/data/SMALL_DATA_CASE6_50 b/data/SMALL_DATA_CASE6_50 index 3bc99ea..81a6254 100644 --- a/data/SMALL_DATA_CASE6_50 +++ b/data/SMALL_DATA_CASE6_50 @@ -1,320 +1,320 @@ -38 48 -43 33 -8 32 -40 13 -24 31 -43 45 -6 26 -7 34 -14 45 -15 12 -32 10 -29 4 -45 37 -12 8 -6 2 -15 32 -31 6 -1 31 -44 12 -43 26 -15 12 -4 18 -2 44 -19 47 -26 3 -36 45 -38 46 -48 45 -36 25 -5 20 -30 32 -15 33 -43 10 -11 3 -11 24 -8 19 -6 37 -6 29 -8 5 -30 21 -43 25 -7 1 -8 21 -8 40 -43 30 -7 40 -40 39 -3 34 +30 3 +22 17 +6 47 +1 15 +6 13 +25 19 +46 23 +30 28 +24 17 +39 6 +49 29 +11 39 +21 22 +19 6 +4 31 +7 44 +35 7 +2 18 +44 45 +18 13 +6 21 +15 13 +3 17 +2 21 +43 11 +6 32 +46 24 +32 36 +21 46 +41 35 +28 44 +23 15 +35 13 +14 10 +47 35 +23 17 +15 11 +21 18 +5 47 +4 9 +18 2 +4 20 +43 46 +25 34 +1 22 +13 25 +26 42 +5 42 +19 22 +14 33 +12 24 +21 7 +46 35 +36 39 +13 14 +47 47 +25 11 +49 5 +21 29 +13 33 +12 22 +46 15 +5 39 +16 25 +11 29 +34 31 +45 14 +23 35 +33 28 +40 14 +31 44 +37 30 +4 32 +26 48 +15 5 +45 21 +14 48 +18 44 +18 48 +22 1 +36 24 +28 42 +17 46 +6 48 +10 41 +15 36 +21 31 +48 36 +45 15 +12 15 +40 26 +40 18 +28 4 +9 14 +3 1 +42 30 +47 1 +36 2 +16 9 +29 7 +7 46 +23 8 +25 26 +12 46 +12 5 +29 3 +42 8 +35 32 +19 23 +21 15 +43 23 +20 47 +17 35 +13 10 +24 8 +21 19 +6 6 +48 42 +11 5 +14 22 +1 5 +47 44 +39 29 +48 28 +27 25 +49 13 +39 34 +48 13 +40 22 +11 8 +7 48 +23 48 +6 47 2 37 -48 14 -24 16 -18 6 -36 40 -37 18 -8 24 -3 22 -14 14 -25 33 -8 17 -11 1 -48 21 -18 6 -12 32 -30 46 -46 17 -18 31 -28 16 -18 14 -33 9 -32 33 -4 29 -14 42 -47 43 -12 36 -45 38 -42 25 -27 13 -6 40 -18 43 -25 24 -45 5 -4 37 -41 8 -16 18 -38 9 -32 40 -37 18 -44 25 -15 16 -45 41 -6 18 -5 17 -14 14 -8 6 -23 21 -2 25 -26 30 -39 17 -26 15 -11 45 -10 9 +18 42 +7 43 +31 39 +3 18 +49 49 +12 5 +23 20 +14 7 +37 47 +21 40 +47 25 +34 25 +4 36 +2 18 +12 5 +36 4 23 43 -15 40 -10 12 -12 37 -9 35 -43 33 -27 18 -32 42 -46 46 -48 37 -27 37 -21 47 -33 49 -8 49 -30 40 -33 31 -30 25 -1 34 -14 46 -35 1 -48 29 -42 36 -34 6 -31 49 -1 17 -41 10 -12 13 -23 1 -15 18 -19 27 -27 42 -35 5 -21 38 -22 30 -20 41 -14 31 -2 6 -34 45 -22 4 -41 8 -44 1 -13 36 -48 22 -2 1 -35 25 -1 35 -40 24 -28 33 -29 22 35 15 -18 12 -18 3 -24 12 +42 39 +34 15 +16 30 +4 41 +14 30 +6 31 +26 36 +28 27 +36 40 +3 30 +46 27 +17 40 +20 25 +26 11 +18 47 +19 25 +49 35 +23 33 +49 30 +8 5 +25 27 +3 43 +45 19 34 2 -7 49 -38 13 -2 8 -36 33 +11 21 +24 45 +25 3 +3 2 +27 28 +7 47 +45 35 +8 31 +19 14 +1 18 +33 49 26 12 -38 21 -33 32 -13 21 -25 45 -47 29 -32 21 -8 5 -22 19 -12 48 -43 29 -30 37 -24 30 -23 42 -5 27 +32 29 +38 6 +8 45 +48 31 +31 17 +34 31 +32 5 +19 10 +2 41 +30 38 6 5 -45 31 -16 45 -13 45 -15 43 -30 21 -18 7 -49 24 -7 39 -20 22 -36 8 -17 45 -48 1 -3 28 -10 34 -23 44 -14 3 -9 19 -28 38 -40 31 -2 30 -6 43 -21 38 -47 7 -6 32 -36 49 -42 15 -5 46 -16 4 -39 31 -30 25 -49 20 -32 17 -11 49 -44 20 -41 30 -5 3 -8 24 -29 22 -8 48 -1 35 -13 29 -41 12 -3 12 -47 25 -45 5 -2 46 -1 30 -14 16 -46 3 -46 9 -19 42 -9 14 -29 1 -8 17 -12 1 -42 14 -44 31 -17 20 -42 34 -42 28 -3 21 -48 44 +34 43 +48 34 +21 27 +39 6 +2 18 +14 6 +37 36 +25 8 +25 46 +34 19 +48 22 +4 26 +7 12 +11 38 +31 24 +13 6 +48 31 +21 14 +38 49 +9 46 +14 2 +13 8 +14 26 +12 3 +15 20 +9 30 +25 34 33 23 -4 10 -39 28 -17 26 -37 23 -27 43 -30 45 -18 32 -32 23 +8 11 +17 39 +4 14 +28 40 +46 36 +4 21 +7 46 +44 2 +29 28 +11 44 +30 12 +35 15 +34 19 +35 36 +36 34 +45 33 +3 11 +30 30 +46 33 +46 24 +21 49 +28 28 +29 43 +13 27 +13 13 +18 34 +18 17 +41 8 +46 9 +42 40 +12 11 +31 9 +1 11 +33 41 +12 2 +47 8 +27 4 23 36 -37 23 -3 25 -3 43 -37 39 -24 10 -48 46 -15 32 -7 16 -16 40 -45 10 -5 35 -39 14 -40 46 -40 38 -44 32 -36 29 -16 39 -16 23 -26 44 -29 42 -45 17 -33 5 -16 10 -31 45 -7 15 -4 41 -33 24 -43 10 -19 48 -13 33 -38 13 -39 37 -5 13 -9 31 -10 18 -9 33 -9 22 -6 45 -10 17 -33 47 -5 1 -17 41 -4 47 -19 15 -30 4 -20 24 -9 40 -38 3 -19 14 -33 11 -49 34 -3 33 -22 28 -14 30 -33 24 -25 18 +35 44 +16 20 +10 4 +19 17 +19 1 +34 29 +1 26 +18 21 +37 25 +44 14 +4 16 +7 36 +27 10 +9 16 +1 25 +6 3 +9 3 +14 49 +32 23 +37 20 +27 22 +22 29 +42 15 +38 38 +18 9 +15 31 +23 19 +23 16 +18 17 33 43 -15 19 -44 21 -7 13 -31 35 -11 20 -44 12 -24 3 -13 10 -10 48 -3 31 -34 28 -25 2 +48 46 47 34 -15 34 -4 17 -32 25 +32 9 +25 42 +14 24 +13 45 +48 16 +26 38 +28 18 +13 13 +3 32 +22 32 +16 28 +8 35 +4 7 +39 17 +46 38 +44 47 +44 34 +23 37 +20 12 +33 20 +29 33 +47 12 +5 41 diff --git a/data/SMALL_DATA_CASE7_60 b/data/SMALL_DATA_CASE7_60 index aaad1a6..2b8fec0 100644 --- a/data/SMALL_DATA_CASE7_60 +++ b/data/SMALL_DATA_CASE7_60 @@ -1,640 +1,640 @@ -43 47 -24 29 -51 55 -20 25 -17 53 -43 2 -37 7 -59 41 -28 9 -10 58 -52 1 -26 43 -40 35 -17 7 -41 8 -6 12 -53 4 -47 28 -18 51 -41 30 -31 55 -54 19 -4 34 -26 15 -16 40 -26 40 -20 48 -27 27 -12 46 -22 56 -54 54 -27 11 -16 39 -24 58 -24 56 -8 10 -5 44 -47 22 -27 24 -57 12 -54 37 -18 2 -41 16 -56 36 -55 55 -8 29 +37 14 +30 42 +35 14 +35 28 +3 36 +1 10 +10 24 +2 55 +56 43 +12 55 +11 53 +38 24 +47 1 +39 46 +5 39 +9 25 +36 56 +2 22 +37 38 +12 20 +56 13 +41 32 +5 35 +29 52 +15 1 +58 34 +45 37 +37 5 +40 58 +53 33 +27 37 +9 12 +31 54 +53 52 +21 37 +29 27 +33 13 +29 48 +53 14 +21 57 +12 52 +44 20 +18 59 +1 1 +11 18 +32 59 +56 17 +44 27 +57 18 +47 10 +53 52 +51 3 +32 10 +26 7 +50 42 +28 58 +55 34 +5 56 +51 1 55 50 -57 8 -18 37 -17 53 -58 30 -23 46 -34 36 -39 16 -4 54 +37 41 +54 58 +12 8 +19 52 +57 44 +40 17 +23 43 +41 7 +53 58 +16 33 +9 54 +44 53 +53 53 +15 18 +55 44 +20 47 +52 47 +1 15 +17 8 +53 3 +14 21 +39 23 +2 57 +31 48 +38 51 +45 52 +10 58 +34 59 +56 48 +37 1 +56 59 +56 29 +31 33 +33 45 +32 5 +12 59 +45 57 23 41 -34 49 -42 16 -33 42 -55 9 -47 30 -34 23 -51 39 -22 47 -38 55 -5 27 -21 23 -24 23 +14 2 +28 47 +35 14 +20 20 +3 16 +37 8 +25 22 +41 2 +10 2 +11 7 +25 59 +6 6 +48 13 +4 16 +34 37 +30 54 +8 28 +54 4 +34 10 +51 51 +24 34 +48 17 +34 47 +10 40 +44 34 +35 44 +25 8 +33 22 +46 58 +2 59 +50 20 +22 43 +12 36 +21 56 +43 54 +41 25 +25 34 +27 22 +19 55 +23 47 +4 10 +15 57 +23 7 +51 6 +38 15 +8 23 +14 7 +11 44 +23 19 +40 16 +9 40 +5 41 +3 36 +53 17 +8 45 +54 13 +21 40 +38 45 +24 45 +55 35 +3 34 +6 21 +19 12 +9 30 +10 23 +29 54 +48 44 +39 57 +39 37 +5 12 +14 24 +28 29 30 5 -50 55 -51 48 -22 10 -11 58 -30 16 -2 25 -35 43 -15 27 -49 20 -36 9 -51 9 -27 56 -6 41 -28 33 -33 36 -54 17 -15 16 -50 31 -53 52 -17 38 -14 35 -13 42 -9 8 -41 14 -7 49 -43 12 +39 33 +17 10 +51 25 +14 50 +41 29 +31 35 +59 46 +7 44 +48 30 +36 47 +19 17 +39 24 +40 8 +1 9 +2 49 10 29 -1 20 -35 3 -9 44 -12 37 -21 33 -48 38 -42 42 -3 48 -24 47 -2 47 -15 12 -58 2 -52 5 -7 17 -40 55 -1 59 -39 5 -21 17 -36 24 -20 29 -5 23 -32 36 -35 58 -7 46 -26 32 -47 52 -24 32 -59 43 -51 28 -26 23 -19 3 -49 29 -50 49 -32 36 -14 4 -38 38 -24 28 -33 50 -11 4 -52 48 -29 58 -44 7 +57 42 +22 42 +22 9 +21 5 +14 10 +11 46 +47 17 +33 15 +2 27 +45 25 +18 48 +40 2 +12 45 +45 55 +15 20 +6 27 +26 58 +27 10 +30 28 +16 36 +33 6 +44 43 +56 22 +35 33 +1 9 +27 1 +29 31 +44 35 +32 25 +31 51 +5 25 +44 29 +3 31 +3 16 +37 22 +19 19 +4 51 +25 10 26 10 -11 33 -56 56 -20 35 -32 32 -34 20 -32 28 -47 7 -39 36 -39 49 -30 10 -32 21 -7 58 -4 43 -49 27 -59 4 -22 26 -30 8 -8 3 -46 5 -20 36 -1 46 +13 13 +34 30 +41 44 +56 2 +49 14 +43 26 +21 10 +39 33 +7 52 51 53 -28 22 -56 11 -19 59 -15 2 -18 57 -30 38 -17 3 -6 56 -33 47 -17 57 -2 7 -29 35 -41 45 -56 48 -5 23 -54 8 -19 21 -13 3 -38 44 -27 46 +56 16 +31 39 +34 21 +7 54 +57 9 +20 58 +55 14 +7 35 +26 57 +50 49 +40 16 +48 42 +45 20 +27 12 +48 40 +21 30 +52 57 +55 49 +11 52 +34 46 +46 39 +36 43 +18 33 +33 45 +56 43 +26 37 +45 44 +13 28 +18 26 +37 59 +25 2 +55 10 +31 52 +15 56 +3 13 +44 24 +6 45 +2 54 +5 8 +30 47 +27 38 +26 57 +37 7 +8 19 +37 47 +42 17 +5 40 45 58 -51 35 -57 3 -54 49 -35 27 -30 14 -14 6 -9 14 -28 33 -20 29 -30 45 -57 36 -14 35 -24 50 -41 45 -17 24 -59 11 -3 7 -39 12 -30 45 -46 4 -2 26 -37 51 -14 8 -45 9 -56 22 -48 35 +49 41 +26 3 +42 14 +24 53 43 44 -21 31 -12 5 -55 39 -54 29 -41 1 -45 24 -38 42 -47 51 -3 25 -8 33 -38 39 +35 37 15 59 -25 39 -35 34 -28 51 -5 46 -24 12 -28 50 -30 5 +39 24 +56 51 +35 11 +22 16 +17 36 +33 49 +29 46 +18 45 +44 29 +26 55 +12 32 +31 50 +12 28 +41 44 +53 54 +40 39 +30 1 +23 29 +30 32 +25 40 +54 54 +36 16 +5 28 +9 53 +53 58 +27 53 +31 6 +2 56 +17 30 +23 23 +57 21 +37 50 +12 41 +2 8 +41 33 +38 54 +58 50 +38 26 +24 57 +27 22 +51 8 +27 54 +18 33 +39 30 +6 8 +50 51 +15 50 +54 20 +47 26 +5 39 +54 44 +30 22 +41 8 +46 54 +45 48 +29 45 +39 51 +41 41 +20 18 +36 49 +30 46 +20 7 +52 46 +2 10 +35 39 +31 19 +45 26 +40 15 +13 56 +36 27 +46 16 +48 38 +47 28 +39 6 +27 41 +57 17 +11 9 +10 26 +13 19 +34 1 +49 51 +14 3 +29 59 +47 44 +37 21 +38 3 +26 16 +17 44 +31 59 +46 2 +5 51 +8 4 +12 27 +40 11 33 56 -44 4 -3 14 -39 25 -33 16 -32 31 -19 44 -40 2 -35 21 -52 45 -43 40 -17 18 -53 50 -14 10 -38 44 -11 55 -30 48 -9 44 -9 39 -58 56 -59 39 -46 58 -28 55 -32 40 +2 54 +38 43 +26 3 +3 7 +28 32 +10 13 +56 20 +36 36 +30 5 +21 47 +26 40 +49 47 +32 16 +52 43 +38 42 +12 22 +44 5 +11 17 +16 33 +29 35 +35 34 +46 13 +6 18 +35 24 +21 37 +56 25 +13 53 +30 31 +25 21 +52 35 +46 44 +38 34 +5 8 +6 26 +36 58 +26 6 +51 54 +41 8 +24 2 +59 49 +48 2 +4 47 +21 55 +18 39 +6 36 +35 7 +32 49 +10 8 +54 29 +5 38 +16 11 +59 23 +32 3 +36 24 +16 53 +56 2 +5 38 +52 29 +35 23 +15 13 +19 7 +43 4 +16 2 +35 49 22 2 -30 6 -56 12 -4 13 -9 13 -41 32 -37 12 -11 58 -41 22 -12 15 -38 2 -42 58 -29 20 -11 49 -12 35 -56 34 -29 54 -31 45 -36 13 -34 24 -18 58 -38 30 -40 50 -27 35 -20 36 -44 47 -41 23 -19 58 -29 20 -41 30 -34 58 -29 33 -57 57 -54 10 -52 18 -39 23 -55 45 -20 54 -50 18 -13 51 -50 47 -58 4 -43 53 -23 57 -55 55 -44 13 -55 20 -38 48 -23 29 -44 11 -52 39 -43 58 -37 51 -58 7 -22 8 -35 53 -2 22 -12 52 -13 38 -46 38 -32 15 -29 21 -9 35 +56 1 +22 1 +47 41 +29 24 +43 56 +58 59 +25 22 +55 49 +34 22 +3 21 +54 35 +51 45 +11 16 +21 5 +13 27 +45 2 +39 25 +53 12 +18 23 +27 57 +21 12 +30 40 +54 51 +16 32 +5 30 +34 55 +19 46 +35 37 +7 20 +56 27 10 55 -53 35 +48 15 +51 6 +38 21 +25 47 +36 17 38 23 -13 34 -21 54 -1 31 -32 15 -33 5 -39 19 -31 4 -4 13 -50 45 -47 50 -45 17 -15 20 -55 9 -46 4 -4 57 -33 39 -41 3 -14 56 +48 30 +16 52 +59 59 +6 11 +10 50 +11 2 +25 35 +20 33 +39 3 +50 35 +6 27 +27 19 +16 19 +20 27 +18 46 +27 10 +13 19 +53 9 +5 51 +30 24 +45 26 +23 29 +51 10 +54 6 +40 47 +43 48 +49 56 +36 22 +43 43 +29 26 +7 4 +44 20 +4 41 +8 53 +56 23 +45 22 +14 50 +37 18 +38 34 +58 23 +3 45 +24 50 +46 34 +48 52 +51 49 +3 1 +5 49 +55 52 +45 28 +49 21 +58 2 +47 26 +36 26 +20 50 +31 10 +55 51 +15 21 +46 48 +25 53 +26 12 17 31 -48 31 -43 31 -37 6 -29 17 -51 22 -43 35 -48 2 -36 5 -10 33 -33 3 -50 16 -21 53 -49 5 -12 40 -21 2 -39 59 -47 53 -33 10 -24 37 -32 44 -14 26 -8 18 -1 15 -1 7 -11 45 -41 13 -40 19 +22 31 +18 42 +38 23 +50 44 +18 28 +27 16 +1 10 34 30 -22 56 -3 52 +59 15 +37 55 +40 50 +1 50 +34 11 +34 31 +17 13 +29 44 +50 33 +40 32 +46 28 +27 55 +27 50 +34 32 +37 45 +17 13 +31 9 +37 24 +21 42 +22 7 +11 16 +55 49 +32 18 +12 57 +4 22 +54 49 +37 38 +4 7 +9 54 +48 35 +7 35 +15 49 +54 47 +34 45 +4 21 +54 39 +37 1 +9 48 +57 35 +4 2 +59 28 +50 29 +26 21 22 46 -22 28 -14 55 -31 7 -13 58 -54 22 -1 1 -14 39 -28 10 -16 3 -18 27 -39 10 -43 32 -45 17 -13 8 -18 17 -21 17 -42 14 -25 4 -48 1 -41 31 -55 22 -24 8 -14 3 -27 31 -48 40 -55 43 -40 47 -18 57 -11 47 -20 40 -38 20 -37 4 +50 28 +31 2 +7 8 +41 3 +18 13 +44 8 +6 51 28 51 -19 49 -13 31 -1 37 -38 42 -20 33 -41 44 -55 39 -9 3 -36 19 -43 29 -22 51 -40 44 -31 34 -10 19 -58 17 -30 1 -50 39 -29 5 -27 48 -49 36 -7 5 -7 31 +47 12 +59 22 20 25 -13 59 -4 46 -13 29 -40 18 -14 10 -48 56 -45 24 -7 15 -39 35 -29 39 -51 51 -6 59 -6 33 -19 24 -51 21 -44 19 -46 47 -14 5 -22 26 -8 12 -42 58 -50 16 -28 8 -12 13 -48 57 -5 50 -48 59 -47 3 -24 22 -53 59 -7 29 -2 46 -13 3 -52 21 -26 19 -20 20 -2 43 -45 3 -15 2 -56 15 -21 33 -56 29 -5 3 -24 36 -39 32 -36 18 -18 43 -27 53 -31 57 -11 55 -27 27 -32 57 -24 34 -6 35 -53 34 -40 36 -41 43 -8 46 -56 42 -18 9 -42 56 -37 16 -41 58 -28 9 -32 46 -43 33 -8 55 -39 21 -51 34 -9 6 -21 17 -43 7 -14 44 -4 40 -49 49 -4 14 -33 42 -28 57 -12 1 -47 39 -29 25 -44 59 -58 9 -41 44 -9 9 -23 1 -2 13 -13 58 -26 9 -20 8 -56 36 -29 6 -42 16 -4 36 -28 32 -36 27 -40 26 -27 43 -42 42 -19 34 -43 52 -19 37 -39 31 -50 41 -11 21 -47 26 -26 3 -50 28 -52 50 -12 43 -18 27 -14 7 -28 17 -53 59 -56 29 -42 51 -7 29 -25 50 -11 28 -11 24 -26 24 -51 53 -36 44 -16 34 -59 57 -8 39 -5 22 -47 38 -37 37 -46 7 -5 58 -40 53 -25 7 -27 21 -59 31 -57 16 -7 4 -6 39 -27 44 -35 29 -20 28 28 14 -48 29 -20 35 -44 8 -43 54 -23 54 -4 8 -9 46 -56 50 -23 47 -51 17 -9 9 -3 56 -27 54 -15 37 -55 32 -22 42 -3 29 -8 23 -58 25 -42 34 -32 6 -14 25 -17 10 -56 42 -19 40 -21 14 -56 5 -18 23 -33 18 -34 36 -16 7 -48 3 -20 56 -10 57 -7 11 -46 37 -8 31 -3 25 -37 39 -6 49 -19 46 -54 55 -56 42 -50 43 -33 54 -13 16 +40 32 +56 46 +5 16 +27 34 +29 19 +47 5 +26 4 +56 48 +5 45 +43 15 +14 23 +48 28 +58 40 +53 32 +3 7 +39 38 +58 34 +5 34 +8 51 18 33 -22 19 -44 48 -58 39 -42 40 -58 10 -42 41 +41 17 +30 36 +18 35 +15 14 +22 55 56 14 -16 30 -49 38 -41 6 -24 44 -30 21 -33 38 -28 38 -54 1 -31 26 -57 23 -43 12 -40 17 -42 24 -32 31 -49 15 -12 24 -27 27 -52 28 -4 22 -46 16 +17 24 diff --git a/data/SMALL_DATA_CASE8_70 b/data/SMALL_DATA_CASE8_70 index 36015c4..60f06e0 100644 --- a/data/SMALL_DATA_CASE8_70 +++ b/data/SMALL_DATA_CASE8_70 @@ -1,1280 +1,1280 @@ -3 12 -12 64 -34 38 -35 18 -31 54 -8 65 -17 30 -19 34 -6 3 -26 59 -32 53 -48 69 -47 24 -9 9 -4 57 -64 26 -27 48 -14 64 -59 23 -4 26 -22 24 -19 45 -4 22 -11 28 -65 45 -53 19 -51 64 -44 8 -63 20 -35 54 -15 68 -68 30 -29 44 -27 6 -17 67 -30 44 -1 22 -32 46 -21 48 -68 35 -45 10 -18 9 -51 58 -49 39 -14 54 -24 65 -20 65 -43 53 -62 67 -14 67 -16 54 -2 38 -16 12 -12 16 -30 15 -43 49 -29 63 -66 29 -52 40 -33 49 -37 20 -58 62 -44 47 -51 33 -47 19 -47 21 -7 45 -47 29 -65 54 -34 54 -14 26 -35 49 -2 56 -61 47 -39 10 -63 51 -54 67 -56 16 -68 53 -30 21 -67 18 -37 28 -60 29 -68 11 -3 60 -35 3 -2 55 -12 47 -56 25 -51 66 -15 31 -22 2 -7 48 -53 48 -27 19 -9 1 -2 40 -30 58 -39 47 -50 20 -23 34 -64 36 -44 56 -4 2 -63 11 -56 6 -60 53 -26 59 -32 19 -7 16 -31 67 -2 51 -1 66 -43 23 -50 52 -40 22 -46 8 -69 16 -60 11 -34 43 -54 42 -16 11 -63 17 -39 22 -32 69 -46 27 -51 42 -49 60 -7 30 -47 59 -16 60 -13 15 -28 39 -40 44 -51 7 +50 28 +45 1 +35 24 +3 66 +12 45 +51 22 +42 57 +65 13 +27 31 +3 23 +46 29 +65 8 +56 47 +52 24 +15 52 7 4 -65 55 -24 27 -30 56 -48 33 -27 27 -32 60 -39 52 -9 61 -61 69 -47 4 -21 45 -21 19 -4 35 -41 59 -56 46 -13 21 -63 52 -36 5 -59 17 -59 59 -36 13 -52 23 -63 39 -53 50 -65 23 -32 65 -53 61 -23 8 -21 5 -46 8 -56 16 -50 43 -40 63 -66 59 -56 37 -30 1 -47 41 -14 34 -48 2 -69 15 -53 65 -15 49 -42 28 -68 3 -6 47 -65 33 -29 16 -15 41 -40 47 -1 19 -22 33 -34 41 +26 46 +33 17 +59 38 +4 28 +24 54 +68 58 +37 17 +21 63 +46 27 +56 10 4 56 -35 33 -9 23 -56 57 -59 33 -21 64 -50 29 -26 36 -8 18 -22 54 -28 17 -6 38 -7 35 -41 36 -13 36 -31 28 -19 54 -6 29 -41 37 -50 43 -6 15 -23 63 -69 63 -10 5 -34 36 -51 61 -62 22 -17 9 -59 3 -60 33 -45 60 -57 60 -47 14 +28 4 +62 25 +13 3 +47 25 +38 61 +58 48 +38 5 +30 63 +65 44 +22 57 +44 34 +13 24 +2 48 +53 51 +55 52 +1 24 +38 68 +33 64 +13 66 +69 3 +64 53 +60 55 +63 6 +47 38 +28 15 +4 2 +16 69 +62 41 +2 44 +26 14 +35 32 +38 61 +26 1 +62 31 +25 49 +48 9 +37 2 +3 66 +23 29 +52 45 +60 11 +55 56 +4 64 +2 64 +35 13 +68 19 +33 12 +47 61 +39 23 +61 40 +69 48 +57 26 +41 65 +68 55 +22 38 +31 22 +48 7 +40 31 +29 18 +22 34 +29 6 +54 55 +67 51 +1 64 +17 13 +58 2 7 15 -31 34 -66 38 -24 69 -36 28 +61 20 +18 24 +68 61 +26 28 +29 54 +39 60 +16 18 +22 21 +23 40 +18 52 +59 62 +60 50 +44 33 +5 59 +18 18 +38 11 +69 50 +5 43 +53 12 +34 46 +45 55 +13 8 +27 57 +10 61 +23 58 +1 56 +40 5 +50 22 +8 69 +34 10 36 27 -68 15 -48 45 -63 2 -6 28 -56 15 -26 37 -15 65 -22 57 -30 52 -64 50 -52 49 -23 68 -54 64 -27 13 -15 29 -11 59 -27 62 -52 16 -11 47 -66 17 -12 68 -30 39 -29 15 -18 28 -46 1 -52 38 -52 65 -45 14 -21 11 -68 5 -52 32 -21 2 -41 63 -45 17 -38 27 -31 23 -23 19 -61 69 -8 56 -31 11 -12 2 -5 9 -9 52 -14 20 -21 48 -18 26 -34 57 -65 57 -60 57 -3 40 -19 3 -52 16 -28 19 -39 9 -36 34 -30 20 -47 69 -17 12 -14 46 -16 25 -29 26 -25 7 -16 22 -60 6 -62 63 -11 41 -24 19 -65 10 -28 20 -40 13 -24 40 -12 69 -5 46 -49 62 -59 64 -40 44 -40 54 -20 40 -46 9 +41 42 +19 55 +36 56 +40 56 +65 25 +12 22 +10 27 +66 42 +60 47 +13 56 +24 61 +27 41 +19 42 +64 9 +23 65 +62 29 +31 1 +32 61 +60 8 +35 7 +19 50 +3 24 +11 26 +43 52 +19 64 +51 42 +12 43 +46 10 +67 68 +1 23 +36 3 +56 45 +27 23 +60 3 22 35 -43 38 -3 69 -29 16 -54 42 -23 63 -60 66 -1 29 -21 6 -55 11 -49 40 -3 56 -14 54 -45 6 -69 56 -21 68 -41 66 -12 50 -64 3 -67 36 -58 45 -30 26 -55 55 -9 13 -27 54 -32 17 -26 15 -42 18 +68 55 +42 16 +37 12 +30 23 +58 11 +42 17 +23 61 +22 5 +61 46 +64 59 +40 39 +15 25 +16 30 +58 46 +37 43 +23 49 +47 41 +6 68 +41 53 +24 58 +61 56 +25 59 +37 7 +37 10 +8 37 +3 44 +20 30 +3 13 +40 2 +60 64 +42 2 +17 22 +33 60 +48 17 +43 28 +29 58 +18 23 +25 62 +15 63 +49 35 +47 61 +26 64 +33 27 +43 62 +42 58 +61 64 +66 62 +10 18 59 47 -26 69 -58 2 -34 34 -18 57 +15 21 +25 42 +26 58 +20 53 +6 11 +54 1 +27 37 +3 19 +55 68 +59 20 +30 51 +45 60 +40 45 +13 29 +63 35 +25 6 +41 39 +11 19 +45 27 +69 50 +16 64 +53 69 +29 49 +7 42 +61 28 +19 16 +56 69 +16 26 +10 48 +48 65 +47 63 +37 39 +23 57 +28 11 4 58 -66 55 -46 27 -55 67 -51 11 -23 51 -8 61 -51 61 -46 52 -6 44 -14 49 +17 45 +40 8 +38 47 +5 8 +36 10 +2 8 +60 35 +16 25 +44 60 +47 11 +7 56 +24 32 +59 55 +20 65 +19 32 +45 23 +7 26 +3 47 +29 32 +7 16 +31 1 +59 41 +23 65 +61 33 +7 17 +68 38 +63 33 +31 47 +9 50 +54 42 +48 53 +64 2 +30 67 +66 22 +56 11 +27 3 +32 51 +58 18 +41 30 +31 61 +61 18 +26 10 +29 57 +24 21 +2 49 +47 29 +35 14 +19 42 +57 55 +49 17 +61 62 +39 18 +53 13 +16 17 +40 49 +10 6 +62 15 +69 31 +58 56 +33 13 +60 10 6 19 -39 68 -11 35 -53 61 -20 59 -52 53 -6 60 -67 14 -6 37 -63 60 -11 3 -18 45 -11 3 -8 12 -67 49 -43 10 -27 51 -32 57 -9 42 -29 56 -46 4 -20 11 -23 17 -9 9 -47 22 -13 24 -14 55 -56 16 -17 31 -68 49 -51 56 -19 28 -53 61 -29 17 -62 9 -22 39 -9 66 -26 68 -8 28 -14 9 -17 28 -56 69 -31 63 -35 54 -47 41 -37 21 -50 44 -69 60 -24 58 -60 2 +2 60 +41 69 +46 58 +39 31 +21 29 +2 65 +41 46 +8 23 +25 26 +3 64 +25 62 +16 1 +51 19 +1 37 +48 8 68 62 -67 29 -17 5 -38 25 -2 52 -34 10 -28 15 -29 34 -59 19 -17 60 -63 28 -65 16 -16 13 -69 13 -30 68 -31 9 -59 34 -62 22 -41 42 -47 39 -49 14 -15 41 -27 4 -68 36 -43 16 -3 54 -6 43 -31 42 -4 1 -12 28 -44 2 -30 21 -58 28 -11 51 -30 31 -46 24 -6 5 -22 68 -61 65 -54 69 -49 18 -15 68 -15 24 45 32 -23 51 -41 21 -30 34 -26 49 -14 24 -12 60 -23 26 -34 35 -50 15 +14 26 +38 18 48 1 +15 31 +14 18 +61 22 +63 12 +32 15 +38 16 +61 54 +28 28 +47 5 +49 19 +44 30 +22 48 +63 15 +7 27 +59 13 +38 58 +38 35 +67 41 +18 50 +60 48 +31 49 +20 43 +42 31 +48 35 +9 24 +1 51 +24 66 +15 59 +46 4 +18 47 +45 58 +27 31 +39 58 +29 51 +14 57 +8 62 +56 57 +6 46 +55 23 +29 4 +40 18 +29 44 +65 68 +34 44 +35 1 +29 40 +57 56 +10 14 +43 47 +58 38 +31 2 +46 52 +69 3 +16 15 +38 40 +27 27 +68 49 +6 13 +67 7 +34 69 +41 60 +61 8 +31 45 +33 46 +13 45 +66 52 +48 38 +60 26 +54 48 +10 3 +54 22 +49 32 +29 36 +45 38 +55 9 +69 29 +34 5 +55 20 +24 44 +8 17 +11 40 +27 60 +40 10 2 41 -44 26 -39 61 -58 65 -35 64 -12 56 -38 55 -20 68 -56 25 -7 68 -41 52 -61 65 -21 40 -26 46 -43 27 -35 43 -62 48 -41 19 -11 64 -32 8 -4 2 -34 10 -61 31 -16 45 -18 68 -54 31 -39 45 -64 67 -4 22 -22 23 -3 65 -58 40 -68 37 -43 24 -10 63 -3 19 -55 1 -3 7 -52 1 -44 53 -67 14 -28 43 -38 51 -25 39 -34 64 -55 16 -54 39 -45 8 -4 46 -45 28 -31 52 -10 64 -39 36 -40 22 -46 29 -28 24 -25 58 -32 65 -62 44 -27 9 -35 3 -51 53 -37 39 -56 63 -20 3 -63 52 -68 50 -28 13 -40 21 -54 49 -15 64 -69 37 -48 20 -57 51 -21 38 -34 16 -2 6 -55 66 -43 12 -37 21 -41 18 -34 56 -43 43 -16 51 -4 24 -9 59 -29 8 -23 31 -10 32 -64 35 -28 1 -51 16 -21 65 -53 24 -62 11 +61 29 +2 49 +36 4 +44 8 +65 50 +27 36 +6 27 +38 64 +33 63 +33 34 +5 65 +30 8 +23 26 +28 47 +54 61 +22 38 +52 68 +1 45 +22 26 +56 42 +56 15 +38 31 +46 19 +66 37 +68 65 +11 20 +64 57 +15 22 +15 25 +60 45 +35 23 +60 49 +48 25 +27 39 +6 64 +51 29 +57 38 +66 28 +37 61 3 50 -11 6 -3 1 -33 16 -50 9 -8 15 -66 45 -19 14 -9 20 -63 65 -14 25 -45 66 -24 16 -25 69 -29 28 -68 52 -29 30 -25 17 -63 62 -27 68 -62 19 -64 44 -61 19 -41 32 -26 42 -54 26 -51 59 -31 5 -33 12 -60 22 -23 4 -44 52 -53 31 -57 34 -28 30 -45 67 -12 18 -11 27 -25 22 -2 3 -8 67 -56 12 -13 57 -35 24 -30 18 -9 8 -20 31 +19 41 +60 30 +27 21 +57 16 +5 44 +35 57 +13 63 +14 5 +14 67 +13 2 +3 36 +31 12 +1 7 +60 43 +19 9 +48 25 +32 10 +40 2 +51 63 +33 9 +13 62 +28 56 +25 40 +58 42 +38 13 +67 25 +67 46 +34 3 +35 23 +5 12 33 64 -39 55 -50 59 -23 48 -3 2 -67 21 -39 23 -37 19 -28 68 -31 48 -16 26 -65 53 -32 63 -56 39 -24 35 -42 4 -63 41 -24 65 -31 15 -54 50 -3 22 -54 5 -64 56 -26 11 -17 27 -55 3 -54 60 -39 18 -54 3 -16 69 -13 33 -69 65 -21 39 -38 32 -29 2 -13 40 -24 59 -19 15 -16 17 -4 32 -44 1 -29 33 -3 51 -31 51 -57 39 -5 26 -36 7 -32 22 +4 49 +49 55 +47 7 +63 55 +56 8 +24 22 +45 7 +64 44 +16 66 +45 14 +60 48 +50 17 +4 9 +50 34 +18 62 +44 53 +7 55 +45 15 +42 19 +41 1 +51 21 +49 61 +31 44 +34 61 +56 31 +7 1 +57 27 +68 27 +36 25 +55 26 +45 37 +14 27 +27 1 +15 4 +52 55 +47 7 +35 11 +51 51 +16 43 +11 2 +34 17 +38 49 +18 46 +14 52 +6 30 +10 31 +55 15 +60 59 +4 62 +32 67 +49 55 +55 65 +68 11 +39 2 +14 38 +25 21 +15 55 +22 1 +51 27 +62 62 +51 5 31 16 -48 7 -8 30 -45 53 -44 42 -55 7 -68 68 -34 22 -15 69 -12 17 -19 67 -51 30 -22 23 -40 58 -32 68 -39 24 -15 66 -50 59 -35 34 -28 57 +50 9 +9 53 +6 19 +60 50 +39 49 +15 50 +24 48 +31 54 +3 33 +8 21 +61 41 +14 5 +7 18 +12 3 +33 43 +52 59 +20 27 +9 54 +58 38 +57 41 +48 3 +1 27 +53 17 +42 13 +64 45 +30 12 +33 8 +37 35 +48 10 +26 66 +49 53 +64 65 +54 20 +47 25 +53 22 +18 6 +40 29 +27 6 +41 48 +14 5 +50 17 +69 67 +33 2 +43 46 +67 46 +15 10 +2 38 +19 45 +51 46 +39 54 +34 10 +48 56 +5 51 +20 4 +42 6 +44 38 +33 32 +8 17 +30 42 +17 13 +16 10 +60 23 +5 47 +31 7 +11 44 +9 29 +3 51 +27 43 +50 49 +22 49 +44 27 +7 8 +10 54 +61 3 +65 35 +37 54 +50 43 +43 12 +57 69 +41 64 +51 31 +8 12 +22 13 +59 5 36 40 -5 56 -68 25 -16 66 -40 58 -35 18 -20 24 -35 45 -57 8 -10 37 -45 3 -60 15 -34 48 -47 37 -41 51 -46 14 -56 21 -8 35 -10 5 -40 23 -51 47 +57 59 +27 54 +22 53 +41 38 +44 60 +49 49 +5 15 +62 21 +36 6 +66 21 54 9 -52 40 -9 16 -54 45 -68 33 -56 30 -52 29 -27 62 -41 29 -18 67 -47 25 -1 37 -32 59 -43 57 -64 6 -68 56 -49 39 -37 56 -1 25 -35 64 -59 48 -32 57 -20 19 -46 45 -39 17 -25 18 -69 9 -9 11 -44 58 -24 5 -26 50 -65 29 +37 51 +43 22 +64 43 +40 2 +53 9 +21 26 +34 64 +42 35 +56 54 +44 14 +68 47 +13 50 +65 6 +26 40 +43 23 +43 11 +58 62 +36 30 +11 68 +65 44 +17 62 +68 67 +57 49 +8 7 +27 13 +68 5 +11 60 +43 28 +42 36 +5 40 +25 4 +14 21 +17 55 +66 49 +18 13 +31 31 +47 46 +50 20 +9 4 +28 1 +19 33 +56 65 +48 30 +21 6 +18 58 +67 17 +20 12 +16 18 +2 46 +13 28 +65 23 +16 58 +26 18 +10 10 +55 10 +11 43 +50 67 +52 57 +17 10 +32 25 +9 28 +52 53 +41 62 +29 69 +51 21 +42 44 +8 29 +49 45 +9 31 +66 15 +64 53 +20 52 +38 21 +39 47 +1 43 +67 57 +60 16 +26 46 +12 1 11 58 -38 11 -34 31 -41 54 +4 32 +6 28 +66 6 +41 9 +30 15 +44 51 +52 65 +10 22 +40 38 +8 6 +31 57 +65 45 +25 64 +18 16 +45 5 +30 56 +66 43 +37 53 +11 52 +9 7 +58 21 +17 46 +5 63 +8 26 +32 34 +37 1 +5 48 +38 27 +55 52 +63 9 +36 66 +63 20 +65 54 +46 30 +26 62 +32 22 +46 61 +42 64 +13 11 +21 20 +38 15 +48 5 +47 13 +12 67 +61 2 +39 31 +45 45 +32 51 +54 52 +10 33 +7 49 +32 14 +66 38 +44 1 +64 64 +47 15 +12 58 +56 54 +46 27 +43 68 +32 50 +15 56 +63 19 +46 67 +18 35 +54 22 +39 58 +43 48 +37 42 +68 56 +69 52 +17 60 11 43 -2 54 -38 56 -26 67 -16 24 -6 20 -1 25 -38 29 -56 53 -36 15 -41 2 -60 40 -12 52 -44 49 -68 32 -41 50 -24 53 -2 42 -5 53 -61 38 -25 15 -34 58 -55 51 -27 24 -53 38 -45 64 -62 51 -17 36 -15 45 -57 45 -30 25 -54 68 -24 41 +32 21 +49 4 +61 18 +17 24 +60 60 +14 21 +59 21 +27 63 +13 3 +7 39 +21 29 +36 36 +61 46 +35 31 +43 30 +33 17 +51 17 +42 21 +57 43 +65 68 +4 67 +42 10 +12 25 +44 42 +37 58 +38 4 +14 11 +69 46 +22 46 +61 14 +60 57 +21 26 +47 58 +35 37 +25 64 +31 55 +37 7 +60 60 +1 51 +47 16 +45 55 +10 69 +2 29 +60 21 +24 17 +58 67 +26 11 +15 30 +66 19 +13 46 +55 24 +32 34 +22 7 +2 17 46 15 -40 58 -66 39 -50 10 -29 41 -5 65 -65 31 -9 18 -40 49 -45 33 -36 10 -46 51 -52 47 -67 60 -28 57 -38 47 -42 29 -64 25 -19 57 -18 11 -35 13 -39 67 -29 45 -51 56 -2 52 -56 64 -18 53 -43 50 -29 45 -55 29 -66 9 -52 4 -68 26 -29 1 +9 54 +20 62 +27 29 +37 30 +5 59 +52 69 +54 12 +21 32 +47 50 +54 28 +51 40 +25 64 +20 21 +63 5 +33 3 +17 6 +49 26 +48 19 +33 53 +48 18 +69 25 +62 49 +25 36 +69 46 +53 43 +11 35 +35 60 +7 24 +56 69 +58 7 +6 33 +54 51 +41 6 +31 49 +44 16 +9 13 +8 16 +61 52 +18 15 +57 57 +11 16 +18 37 +7 51 +65 68 +59 26 +24 13 +45 3 +49 32 +2 15 +35 27 +69 23 +64 34 +67 16 +58 38 +24 21 +10 39 +26 8 +9 29 +65 18 5 10 -34 22 -43 31 -37 55 -1 34 -32 3 -9 8 -59 19 -24 9 -61 41 -12 39 -28 32 -55 15 -38 66 -47 20 -16 60 -7 68 -5 6 -23 2 -39 13 -3 40 -3 1 -27 65 -58 58 -46 43 -17 49 -58 41 -68 61 +47 51 +29 29 +44 37 +32 47 +12 45 +33 63 +43 54 +34 14 +20 48 +46 33 +63 24 +46 57 +15 27 +43 53 +52 53 +33 47 +58 59 +1 31 +7 18 +25 8 +13 37 +18 38 +48 37 +59 27 +27 6 +55 61 +21 22 +64 59 +39 1 +40 43 +38 46 +56 49 +9 2 +41 12 +62 44 +57 39 +44 18 +51 51 +3 8 +5 34 +64 46 +26 30 +52 52 +4 29 +21 22 +18 52 +50 19 +34 47 +67 33 +58 46 8 62 -63 42 -59 32 -9 52 -52 22 -53 5 -61 3 -42 58 -36 18 +51 43 +3 40 +68 59 +67 17 +68 3 +50 35 +43 46 +29 7 +59 15 +40 59 +3 61 +30 9 +1 46 +64 66 +46 25 +56 11 +8 57 +55 5 +29 12 +13 43 +12 37 +1 52 +30 56 +48 30 +2 50 +20 27 25 31 -56 12 -53 5 -56 59 -67 13 -19 43 -5 56 -68 56 -69 30 -51 28 -34 53 -41 55 -37 1 -12 18 -18 53 -64 39 -58 38 -25 23 -13 46 -12 22 -39 28 -3 58 -32 37 -49 64 -13 31 -44 28 -38 5 -67 4 -67 63 -11 20 -24 62 -7 30 -14 3 -37 43 -6 2 -21 35 -56 63 -27 46 -31 54 -36 32 -35 60 -17 16 -54 66 -67 31 -60 42 -31 9 -46 61 -40 8 -26 27 -22 24 -65 63 -26 4 -2 30 -31 63 -9 16 -26 63 -6 4 -9 4 -53 11 -41 58 -10 23 -5 2 -6 23 -4 60 -48 26 -22 28 -9 28 +20 28 +39 59 +33 42 +30 39 +63 45 +69 1 +15 56 +34 15 +10 2 +11 39 +54 5 +22 58 +61 21 +51 3 +54 18 +58 25 +13 40 +61 29 +5 5 +34 1 +32 19 +42 63 +65 18 +29 10 +33 47 +60 23 +35 29 +27 57 +60 62 +25 16 +60 62 +56 18 +33 32 +21 31 +29 59 +65 67 5 23 -38 20 -52 13 -12 15 -10 20 -5 44 -37 52 -5 26 -16 51 -2 58 -46 26 -54 3 -11 64 -25 55 -12 14 -34 2 -44 10 -36 61 -58 40 -49 47 -66 57 -46 61 -29 21 -36 7 -19 52 -23 31 -53 12 -59 50 -28 46 -12 39 -16 52 -14 18 -11 52 -63 44 -25 37 -31 36 -54 48 -33 25 -50 39 -48 46 -9 10 -14 44 -27 26 -3 54 -32 6 -29 63 -28 1 -61 8 -8 11 -50 67 -13 5 -12 69 -25 6 -3 61 -60 15 -41 36 -24 51 -66 46 -62 58 -56 35 -47 30 -8 67 -23 32 -67 8 -16 38 -43 50 -64 7 -25 32 -22 39 -49 40 -41 2 -49 57 -5 4 -16 39 -4 20 -43 24 -53 14 -31 34 -58 67 -21 34 -35 8 +52 68 +35 35 +20 39 +56 55 +27 15 +3 1 +63 32 +25 29 38 48 -43 12 -10 28 -35 44 -47 22 -64 18 -13 15 -52 47 -22 24 -30 40 -38 44 -61 24 -32 61 -35 63 -67 38 -38 69 -59 31 -51 27 -28 47 -44 34 -24 26 -36 32 -25 60 -1 63 -63 31 -65 19 -66 23 -54 42 -2 34 -45 33 -29 30 -6 42 -35 33 -25 33 -21 64 -11 11 -59 20 -8 27 -28 57 -64 41 -62 31 -48 28 -43 16 -26 25 -4 8 +2 43 +65 53 +21 27 +7 22 +5 66 +36 21 +37 43 +33 37 +16 44 +22 41 +54 27 +61 48 +55 41 +53 64 +6 51 +34 65 +63 50 +10 14 +22 44 +10 13 +10 50 +1 68 +64 40 +68 2 +19 31 +31 67 +17 30 +58 37 +10 62 +29 62 +28 23 +29 39 +6 50 +59 30 +35 11 +46 56 +29 66 +41 52 +45 66 +52 51 +4 24 +13 49 +60 9 +35 16 +6 27 +69 64 +13 24 +28 32 +66 66 +25 2 +26 38 +26 37 +43 21 +46 6 +69 32 +67 39 +58 39 +39 53 +56 37 +45 40 +15 19 +47 65 +56 7 29 22 -60 66 -59 3 -41 31 -43 20 -57 28 -28 56 -66 5 -27 19 -30 34 -24 22 -37 2 -5 39 -3 21 -35 30 -61 53 -16 24 -57 57 -38 65 -11 59 -36 30 -55 65 -63 17 -4 35 -62 18 -41 33 -49 52 -57 13 -8 6 -62 19 -57 25 -4 49 -27 61 -69 6 -18 30 -6 55 -54 11 -69 10 -6 58 -37 61 -31 10 -47 47 -59 19 -13 46 -6 48 -65 37 -13 57 -16 50 -5 64 -29 52 -64 25 -35 7 -10 38 -44 65 -4 34 -25 58 -39 23 -52 35 -20 60 -20 48 -19 14 -65 14 -3 21 -25 41 -25 60 -50 55 -14 61 -14 44 -52 66 -64 19 -55 2 -61 37 -20 8 -16 32 -39 19 -16 64 -12 43 -7 39 -16 6 -14 66 -51 17 -57 16 -34 9 -28 63 -68 40 -8 10 -33 49 -62 3 -14 5 -69 67 -2 19 -62 47 -50 25 -32 42 -65 26 -66 15 -49 60 -54 44 +5 27 +40 41 20 18 -58 60 -21 33 -38 53 -12 6 -2 67 +57 42 +68 56 +60 24 +55 58 +12 8 +37 36 +40 5 +56 22 +34 46 +57 49 +23 10 +37 40 +38 20 +38 43 +64 30 +9 1 +66 50 +68 61 +16 21 +26 10 +11 7 +63 39 +43 55 +27 66 +65 68 +24 21 +23 69 +3 36 +41 1 +57 14 +37 31 +14 39 +68 55 +31 21 +54 51 +52 16 +9 63 +59 61 +27 55 +28 66 +69 61 +4 62 +51 41 +23 26 +52 56 +46 16 +44 14 +23 43 +31 1 +54 46 +15 30 +7 40 +7 31 +1 45 +61 32 +53 38 +42 13 +66 33 +45 14 48 57 -69 30 -48 32 -43 22 -68 60 -56 65 -2 57 -18 64 -48 14 -57 55 -47 50 -64 2 -37 44 -14 10 -41 3 -15 27 -36 4 -62 34 -32 1 -7 5 -64 22 -47 60 -29 11 -25 14 -16 61 -55 40 -16 49 -26 53 -21 31 -15 53 -25 10 -44 67 -39 45 -6 39 -37 59 -31 60 -36 49 -43 56 -64 10 -41 41 -20 48 -49 15 -68 68 -58 64 -56 24 -65 40 -17 11 -47 24 -59 14 -64 51 -8 3 -45 46 -10 10 -54 59 -18 54 -3 2 -2 35 -42 42 -53 56 -3 45 -49 49 -3 21 -60 65 -27 56 -59 55 -12 49 -25 27 -13 58 -4 23 -48 44 -12 52 -37 8 -41 54 -49 8 -57 19 -65 32 -25 4 -63 55 -39 28 -63 12 -68 60 -57 13 -35 26 +53 15 +24 7 +24 25 +21 6 +41 7 +43 64 +63 24 +32 15 +39 16 +46 34 +53 46 +35 27 +32 9 +65 33 +56 8 +7 28 +7 43 +10 38 +34 20 +31 33 +65 57 +35 23 +14 7 +45 8 +25 55 +57 9 +61 68 +1 54 +23 38 +14 14 +36 45 +54 24 +37 18 +9 2 +61 68 +40 43 +7 61 +67 36 +59 40 +34 41 +60 13 +38 23 +5 21 +37 62 +35 14 +69 47 +47 38 +2 54 +61 36 +4 12 +47 7 +6 50 64 59 -25 28 -20 35 -5 6 -55 45 -26 5 -49 28 -38 51 -23 39 -24 26 -26 64 -33 64 -30 64 -28 37 -66 26 -25 13 -16 23 -69 66 -17 56 -49 9 -65 30 -24 61 -30 45 -39 43 -36 34 -8 63 -39 33 -66 62 -12 44 -4 69 -5 54 -66 16 -27 11 -13 20 -33 38 -12 51 -11 14 -48 55 -45 69 -3 29 -29 60 -67 66 -9 28 -12 34 -52 41 -63 22 -35 21 -35 45 -15 69 -61 69 -67 20 -12 48 -45 69 -57 57 -16 11 -19 63 -50 40 -21 7 -45 23 -67 54 -52 47 -37 23 +62 56 +57 67 +18 13 +27 64 +44 5 16 34 -38 16 -67 69 -52 52 -54 11 -33 31 -59 42 -29 69 -30 29 -31 49 -37 69 -3 39 -18 21 +66 29 +30 37 +28 35 +18 34 +18 8 +6 20 +46 45 +8 32 +24 29 +56 33 +65 66 +15 63 +26 41 +56 1 +27 67 +46 27 +56 26 +57 37 +45 15 +61 62 +28 47 +31 55 +9 15 +28 38 +25 23 +17 17 +31 59 +41 63 +26 67 +33 24 +53 68 +41 12 +36 11 +53 60 +30 46 +45 4 +27 42 +11 34 +55 67 +67 37 +43 55 +53 12 +26 54 +30 8 +4 33 +28 18 +51 18 +66 49 +67 66 +13 26 +41 60 +23 29 +2 69 +10 23 +11 66 +58 18 +21 49 +66 55 +50 49 +61 10 +2 1 +43 30 +63 30 diff --git a/src/Main.java b/src/Main.java index 974288d..76dbbe0 100644 --- a/src/Main.java +++ b/src/Main.java @@ -7,7 +7,6 @@ import src.datastructure.DataCarrier; import src.datastructure.KDTreeIntegers; import src.datastructure.SequentialAlgorithm; -import src.node.IntegerNode; import src.utils.CoordinateReader; import src.utils.ExcelExport; import src.utils.ProcessTimeRecorder; @@ -19,7 +18,7 @@ class Main { //Range over 4 produces integer representation overflow - final String INPUT_FILE_NAME = "./data/SMALL_DATA_CASE2_10"; + final String INPUT_FILE_NAME = "./data/SMALL_DATA_CASE5_40"; final String EXCEL_FILE_NAME = "./data/dataProfile.txt"; File EXCEL_FILE = new File(EXCEL_FILE_NAME); ExcelExport excelExport = new ExcelExport(); @@ -67,21 +66,27 @@ public void executeAlgorithm(ArrayList targetPoints) { //nearest distance DataCarrier result = sequentialAlgorithm.findCloestDistance(targetPoints); String seqResultInString = result.toString(); - System.out.println(seqResultInString.toString()); + System.out.println("Sequential search: " + seqResultInString.toString()); //construct kd tree KDTreeIntegers kdTreeInt = new KDTreeIntegers(matrix); long constructionTimeStart = System.nanoTime(); kdTreeInt.buildKDTree(); ProcessTimeRecorder.KDTreeConstructionTime += System.nanoTime() - constructionTimeStart; - kdTreeInt.printTree(); //find point in kd tree long searchTimeStart = System.nanoTime(); - DataCarrier kdResult = kdTreeInt.find(targetPoints); + DataCarrier kdResult = kdTreeInt.findKDTreeNormal(targetPoints); ProcessTimeRecorder.KDTreeSearchTime += System.nanoTime() - searchTimeStart; - System.out.println(kdResult.toString()); + System.out.println("KDTree search: " + kdResult.toString()); + //KNN algorithm + kdTreeInt.findKNNAlgorithm(targetPoints, + kdResult.getTreeNode()); + + System.out.println("KDTree with KNN search: " + kdTreeInt.KNN_result.toString()); + + //kdTreeInt.printTree(); //export data to Excel file try { //reset first excelExport.resetContnet(EXCEL_FILE); diff --git a/src/datastructure/DataCarrier.java b/src/datastructure/DataCarrier.java index 7b7c090..5259352 100644 --- a/src/datastructure/DataCarrier.java +++ b/src/datastructure/DataCarrier.java @@ -1,9 +1,12 @@ package src.datastructure; -import src.node.IntegerNode; +import java.util.ArrayList; + import src.datastructure.KDTreeIntegers.IntegerTreeNode; +import src.node.IntegerNode; public class DataCarrier { + IntegerTreeNode treeNode; IntegerNode resultNode; double distance; int depth; //depth is 0 on Sequential list @@ -15,9 +18,10 @@ public DataCarrier(IntegerNode node, double distance) { public DataCarrier(IntegerTreeNode node, double distance) { //make tree node to node - IntegerNode newNode = new IntegerNode(node.points); + IntegerNode newIntegerNode = new IntegerNode(node.points); this.depth = node.getDepth(); - this.resultNode = newNode; + this.treeNode = node; + this.resultNode = newIntegerNode; this.distance = distance; } @@ -34,7 +38,7 @@ public String getNodeToString() { } public String toString() { - return "Closest node: " + this.resultNode.toString() + " in distance " + this.distance + "\n"; + return this.resultNode.toString() + " in distance " + this.distance + "\n"; } public void setIntegerNode(IntegerNode resultNode) { @@ -44,4 +48,16 @@ public void setIntegerNode(IntegerNode resultNode) { public void setDistance(double distance) { this.distance = distance; } + + public IntegerTreeNode getTreeNode() { + return this.treeNode; + } + + public ArrayList getPoints() { + return this.resultNode.getPoints(); + } + + public IntegerTreeNode getParentNode() { + return this.treeNode.getParentNode(); + } } diff --git a/src/datastructure/KDTreeIntegers.java b/src/datastructure/KDTreeIntegers.java index cf6b0d6..5931ab4 100644 --- a/src/datastructure/KDTreeIntegers.java +++ b/src/datastructure/KDTreeIntegers.java @@ -5,7 +5,6 @@ import java.util.Comparator; import java.util.Deque; -import src.node.IntegerNode; import src.utils.ProcessTimeRecorder; /* @@ -17,16 +16,18 @@ public class KDTreeIntegers { IntegerTreeNode root; int deepestDepth = 0; ArrayList> entireMatrix; + public DataCarrier KNN_result; + IntegerTreeNode shortestNode; + double shortestDistance; //initializes, but doesn't construct the tree public KDTreeIntegers(ArrayList> entireMatrix) { this.entireMatrix = new ArrayList>(entireMatrix); - System.out.println("Array size: " + this.entireMatrix.size()); } //constructs the tree public void buildKDTree() { - insert(0, this.entireMatrix, null); + insert(0, this.entireMatrix, null, null); } //sort by the dimension axis of the ArrayList @@ -46,7 +47,8 @@ public int compare(ArrayList o1, ArrayList o2) { //Must know the construction time - measuring required public void insert(int depth, ArrayList> particalMatrix, - IntegerTreeNode currentNode) { + IntegerTreeNode currentNode, + IntegerTreeNode parentNode) { Runtime runtime = Runtime.getRuntime(); long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory(); @@ -77,6 +79,7 @@ public void insert(int depth, median = particalMatrix.size() / 2; + currentNode.setParentNode(parentNode); currentNode.setAxis(axis); currentNode.setDepth(depth); currentNode.setPoints(pointSegment); @@ -93,19 +96,19 @@ public void insert(int depth, if (leftList.size() != 0) { IntegerTreeNode leftChild = new IntegerTreeNode(); currentNode.setLeftChild(leftChild); - insert(depth + 1, leftList, leftChild); + insert(depth + 1, leftList, leftChild, currentNode); } + if (rightList.size() != 0) { IntegerTreeNode rightChild = new IntegerTreeNode(); currentNode.setRightChild(rightChild); - insert(depth + 1, rightList, rightChild); + insert(depth + 1, rightList, rightChild, currentNode); } - long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory(); ProcessTimeRecorder.KDTreeSize += usedMemoryAfter-usedMemoryBefore; } - public DataCarrier find(ArrayList points) { + public DataCarrier findKDTreeNormal(ArrayList points) { //start from the root IntegerTreeNode traverse = root; IntegerTreeNode closestNode = root; @@ -129,10 +132,63 @@ public DataCarrier find(ArrayList points) { traverse = traverse.rightChild; } } + shortestNode = closestNode; + shortestDistance = closestDistance; DataCarrier carrier = new DataCarrier(closestNode, closestDistance); + KNN_result = carrier; return carrier; } + + //shortest node with current walking node + //parameters must be the value from kdtree search + //Must run this after running KD tree algorithm + public void findKNNAlgorithm(ArrayList targetPoints, + IntegerTreeNode walkingNode) { + //check current node + if (!walkingNode.isVisited()) { + double currentDistance + = calculateDistance(walkingNode.getPoints(), targetPoints); + if(currentDistance < this.shortestDistance) { + DataCarrier newDataCarrier = new DataCarrier(walkingNode, currentDistance); + KNN_result = newDataCarrier; + this.shortestNode = walkingNode; + this.shortestDistance = currentDistance; + } + } + + //visitation set + int comparingAxis = walkingNode.getAxis(); + walkingNode.setVisited(); + + //left child check + if (walkingNode.leftChild != null) { + if (!walkingNode.leftChild.isVisited()) { + findKNNAlgorithm(targetPoints, walkingNode.leftChild); + } + } + + //right child check + if (walkingNode.rightChild != null) { + if (!walkingNode.rightChild.isVisited()) { + findKNNAlgorithm(targetPoints, walkingNode.rightChild); + } + } + + //root check before going into the parent + if (walkingNode.parent != null) { + Integer currentPointByAxis = walkingNode.getPoints().get(comparingAxis); + Integer parentPointByAxis = walkingNode.parent.getPoints().get(comparingAxis); + Integer targetPointByAxis = targetPoints.get(comparingAxis); + double shortest_parent = getRSqured(currentPointByAxis, parentPointByAxis); + double shortest_target = getRSqured(currentPointByAxis, targetPointByAxis); + //check distance by axis + if (shortest_target >= shortest_parent) { + findKNNAlgorithm(targetPoints, walkingNode.parent); + } + } + } + private double calculateDistance(ArrayList given, ArrayList target) { Integer total = 0; @@ -144,6 +200,13 @@ private double calculateDistance(ArrayList given, return Math.sqrt(total); } + private double getRSqured(Integer a, Integer b) { + int diff = a - b; + double squared = diff * diff; + double squareRoot = Math.sqrt(squared); + return squareRoot; + } + public void printTree() { StringBuilder sb = new StringBuilder(); printDFS(root, sb); @@ -192,23 +255,26 @@ private void printBFS() { private void printBFSTree(Deque list) { StringBuilder sb = new StringBuilder(); int currentDepth = 0; - int count = 0; while(!list.isEmpty()) { IntegerTreeNode tempNode = list.removeFirst(); if (currentDepth != tempNode.getDepth()) { sb.append("\n"); currentDepth = tempNode.getDepth(); - count = 0; } + if (!tempNode.hasChild()) { + sb.append("parent:"); + sb.append(tempNode.parent.getPoints().toString()); + sb.append("/"); + } sb.append(tempNode.getPoints().toString()); sb.append(" - "); - count++; } System.out.println(sb.toString() + "\n"); } public class IntegerTreeNode { IntegerTreeNode parent; + IntegerTreeNode current; ArrayList points; IntegerTreeNode leftChild; IntegerTreeNode rightChild; @@ -224,6 +290,10 @@ public ArrayList getPoints() { return this.points; } + public IntegerTreeNode getParentNode() { + return this.parent; + } + public void setDepth(int depth) { this.depth = depth; } @@ -262,5 +332,18 @@ public void setRightChild(IntegerTreeNode rightChild) { public IntegerTreeNode getRightChild() { return rightChild; } + + public void setParentNode(IntegerTreeNode parent) { + this.parent = parent; + } + + public void setVisited() { + this.visited = true; + } + + public boolean isVisited() { + return this.visited; + } + } } diff --git a/src/utils/CoordinateReader.java b/src/utils/CoordinateReader.java index c6605d1..80e2826 100644 --- a/src/utils/CoordinateReader.java +++ b/src/utils/CoordinateReader.java @@ -5,8 +5,6 @@ import java.io.FileReader; import java.util.ArrayList; -import src.datastructure.SequentialAlgorithm; - /* * @author: Marco Backman * @email : roni2006@hanmail.net