Skip to content

Commit

Permalink
final commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoBackman committed Sep 26, 2021
1 parent 610b1e3 commit 5e58c11
Show file tree
Hide file tree
Showing 20 changed files with 76,345 additions and 76,498 deletions.
1,200 changes: 600 additions & 600 deletions data/POINTS_100_600.dat

Large diffs are not rendered by default.

19,200 changes: 9,600 additions & 9,600 deletions data/POINTS_1600_9600.dat

Large diffs are not rendered by default.

2,400 changes: 1,200 additions & 1,200 deletions data/POINTS_200_1200.dat

Large diffs are not rendered by default.

38,400 changes: 19,200 additions & 19,200 deletions data/POINTS_3200_19200.dat

Large diffs are not rendered by default.

4,800 changes: 2,400 additions & 2,400 deletions data/POINTS_400_2400.dat

Large diffs are not rendered by default.

76,800 changes: 38,400 additions & 38,400 deletions data/POINTS_6400_38400.dat

Large diffs are not rendered by default.

9,600 changes: 4,800 additions & 4,800 deletions data/POINTS_800_4800.dat

Large diffs are not rendered by default.

100 changes: 0 additions & 100 deletions data/auto_generated_coord.dat

This file was deleted.

Empty file removed data/cooridination2D.dat
Empty file.
Empty file removed data/cooridination3D.dat
Empty file.
112 changes: 56 additions & 56 deletions data/dataProfile.txt
Original file line number Diff line number Diff line change
@@ -1,119 +1,119 @@
Target point: [5, 5]
Sequential:Closest node: [3, 4] in distance 1.7320508075688772
---------------------------
Target point: [5, 5, 5]
Sequential:Closest node: [4, 6, 7] in distance 2.3268462696046543

KDTree:Closest node: [3, 4] in distance 1.7320508075688772
KDTree:Closest node: [4, 6, 7] in distance 2.3268462696046543

---------------------------
Number of points 100

Sequential
Construction time(ns): 72600
Search time(ns): 72600
Construction time(ns): 134285
Search time(ns): 46749

KDTree
Construction time(ns): 3779300
Search time(ns): 21000

Construction time(ns): 1262882
Search time(ns): 12702

Target point: [5, 5]
Sequential:Closest node: [5, 4] in distance 1.0
---------------------------
Target point: [5, 5, 5]
Sequential:Closest node: [29, 9, 4] in distance 2.7063915681838724

KDTree:Closest node: [5, 4] in distance 1.0
KDTree:Closest node: [29, 9, 4] in distance 2.7063915681838724

---------------------------
Number of points 200

Sequential
Construction time(ns): 160300
Search time(ns): 160300
Construction time(ns): 239773
Search time(ns): 65059

KDTree
Construction time(ns): 5091100
Search time(ns): 27900

Construction time(ns): 2545068
Search time(ns): 9104

Target point: [5, 5]
Sequential:Closest node: [3, 7] in distance 2.449489742783178
---------------------------
Target point: [5, 5, 5]
Sequential:Closest node: [335, 15, 6] in distance 4.66223566042384

KDTree:Closest node: [3, 7] in distance 2.449489742783178
KDTree:Closest node: [335, 15, 6] in distance 4.66223566042384

---------------------------
Number of points 400

Sequential
Construction time(ns): 418300
Search time(ns): 418300
Construction time(ns): 480125
Search time(ns): 104761

KDTree
Construction time(ns): 4538900
Search time(ns): 16300

Construction time(ns): 6472364
Search time(ns): 12221

Target point: [5, 5]
Sequential:Closest node: [19, 7] in distance 4.242640687119285
---------------------------
Target point: [5, 5, 5]
Sequential:Closest node: [71, 27, 7] in distance 5.239473141368047

KDTree:Closest node: [19, 7] in distance 4.242640687119285
KDTree:Closest node: [71, 27, 7] in distance 5.239473141368047

---------------------------
Number of points 800

Sequential
Construction time(ns): 669600
Search time(ns): 669600
Construction time(ns): 910560
Search time(ns): 281506

KDTree
Construction time(ns): 42408800
Search time(ns): 19900
Construction time(ns): 14214608
Search time(ns): 14830

---------------------------
Target point: [5, 5, 5]
Sequential:Closest node: [1063, 9, 1] in distance 6.983690945076813

Target point: [5, 5]
Sequential:Closest node: [52, 3] in distance 7.14142842854285

KDTree:Closest node: [52, 3] in distance 7.14142842854285
KDTree:Closest node: [1063, 9, 1] in distance 6.983690945076813

---------------------------
Number of points 1600

Sequential
Construction time(ns): 723100
Search time(ns): 723100
Construction time(ns): 1723079
Search time(ns): 537726

KDTree
Construction time(ns): 34562100
Search time(ns): 352200
Construction time(ns): 36119433
Search time(ns): 24221

---------------------------
Target point: [5, 5, 5]
Sequential:Closest node: [1572, 25, 4] in distance 6.734305734303527

Target point: [5, 5]
Sequential:Closest node: [84, 4] in distance 8.94427190999916

KDTree:Closest node: [84, 4] in distance 8.94427190999916
KDTree:Closest node: [1572, 25, 4] in distance 6.734305734303527

---------------------------
Number of points 3200

Sequential
Construction time(ns): 6900100
Search time(ns): 6900100
Construction time(ns): 3381486
Search time(ns): 1063040

KDTree
Construction time(ns): 68698200
Search time(ns): 17100
Construction time(ns): 72048579
Search time(ns): 11020

---------------------------
Target point: [5, 5, 5]
Sequential:Closest node: [6330, 74, 4] in distance 10.309707828339219

Target point: [5, 5]
Sequential:Closest node: [106, 8] in distance 10.488088481701515

KDTree:Closest node: [106, 8] in distance 10.488088481701515
KDTree:Closest node: [6330, 74, 4] in distance 10.309707828339219

---------------------------
Number of points 6400

Sequential
Construction time(ns): 1483600
Search time(ns): 1483600
Construction time(ns): 6150585
Search time(ns): 2089660

KDTree
Construction time(ns): 195127700
Search time(ns): 22700

Construction time(ns): 184920261
Search time(ns): 30805

Empty file removed data/data_case_1.dat
Empty file.
14 changes: 9 additions & 5 deletions src/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* @author: Marco Backman
* @email : roni2006@hanmail.net
*/



class Main {
//Range over 4 produces integer representation overflow
Expand Down Expand Up @@ -90,19 +88,26 @@ private void runMultipleTimes(ArrayList<Integer> inputPoints) {
String data3 = "Construction time(ns): "
+ ProcessTimeRecorder.sequentialConstructionTime + "\n";
String data4 = "Search time(ns): "
+ ProcessTimeRecorder.sequentialConstructionTime + "\n";
+ ProcessTimeRecorder.sequentialSearchTime + "\n";
String data4_1 = "Space complexity: "
+ ProcessTimeRecorder.sequentialSize + "\n\n";
String data5 = "\nKDTree\n";
String data6 = "Construction time(ns): "
+ ProcessTimeRecorder.KDTreeConstructionTime + "\n";
String data7 = "Search time(ns): "
+ ProcessTimeRecorder.KDTreeSearchTime + "\n\n";
+ ProcessTimeRecorder.KDTreeSearchTime + "\n";
String data7_1 = "Space complexity: "
+ ProcessTimeRecorder.KDTreeSize + "\n\n";

sb.append(data1);
sb.append(data2);
sb.append(data3);
sb.append(data4);
//sb.append(data4_1);
sb.append(data5);
sb.append(data6);
sb.append(data7);
//sb.append(data7_1);

//append measured time to Excel
try {
Expand Down Expand Up @@ -151,7 +156,6 @@ public void runOneCase(int dimension,
kdTreeInt.buildKDTree();
ProcessTimeRecorder.KDTreeConstructionTime += System.nanoTime() - constructionTimeStart;


//find closest point in kd tree
long searchTimeStart = System.nanoTime();
result = kdTreeInt.find(inputPoints);
Expand Down
1 change: 1 addition & 0 deletions src/datastructure/DataCarrier.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package src.datastructure;

import src.node.IntegerNode;
import src.datastructure.KDTreeIntegers.IntegerTreeNode;

public class DataCarrier {
Expand Down
5 changes: 0 additions & 5 deletions src/datastructure/KDTree.java

This file was deleted.

6 changes: 6 additions & 0 deletions src/datastructure/KDTreeIntegers.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.Comparator;

import src.utils.ProcessTimeRecorder;

/*
* @author: Markco Backman
* @email : roni2006@hanmail.net
Expand Down Expand Up @@ -43,6 +45,8 @@ public int compare(ArrayList<Integer> o1, ArrayList<Integer> o2) {
public void insert(int depth,
ArrayList<ArrayList<Integer>> particalMatrix,
IntegerTreeNode parentNode) {
Runtime runtime = Runtime.getRuntime();
long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
//termination condition
if (particalMatrix == null) {
return;
Expand Down Expand Up @@ -89,6 +93,8 @@ public void insert(int depth,
}
}

long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
ProcessTimeRecorder.KDTreeSize += usedMemoryAfter-usedMemoryBefore;
if (leftList.size() != 0) {
//make left child and connect recursively
IntegerTreeNode leftChild = new IntegerTreeNode();
Expand Down
Loading

0 comments on commit 5e58c11

Please sign in to comment.