Repository: intellistream/Sesame (language: python)

Issue:
Code Reformat to include more evaluations



Discussion / hints:

Fix patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad2c7026..6627ea17 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.14)
 project(SESAME CXX)
 
 # Judge the os system
-
 if (UNIX AND NOT APPLE)
     add_definitions(-DUSELOG4CXX)
     MESSAGE(STATUS "Enalbe Log4CXX")
diff --git a/include/Evaluation/Evaluation.hpp b/include/Evaluation/Evaluation.hpp
index 5001e046..ebcaad48 100644
--- a/include/Evaluation/Evaluation.hpp
+++ b/include/Evaluation/Evaluation.hpp
@@ -9,6 +9,9 @@
 #include <Algorithm/DataStructure/Point.hpp>
 #include <vector>
 namespace SESAME {
+
+enum evaluateType { euclideanCost };
+
 class Evaluation {
  public:
   static void euclideanCost(int numberOfPoints,
diff --git a/include/Sources/DataSource.hpp b/include/Sources/DataSource.hpp
index 70acd84d..11f378ed 100644
--- a/include/Sources/DataSource.hpp
+++ b/include/Sources/DataSource.hpp
@@ -31,6 +31,7 @@ class DataSource {
   void load(int point_number, int dimension, vector <string> input);
   bool empty();
   PointPtr get();
+  std::vector<PointPtr> getInputs();
   DataSource();
   ~DataSource();
   void runningRoutine();
diff --git a/include/Utils/BenchmarkUtils.hpp b/include/Utils/BenchmarkUtils.hpp
index b1ed3464..b4deaa52 100644
--- a/include/Utils/BenchmarkUtils.hpp
+++ b/include/Utils/BenchmarkUtils.hpp
@@ -19,6 +19,7 @@
 #include <Sources/DataSource.hpp>
 #include <Sinks/DataSink.hpp>
 #include <Algorithm/Algorithm.hpp>
+#include <Evaluation/Evaluation.hpp>
 
 struct param_t {
   int pointNumber;
@@ -46,7 +47,7 @@ struct param_t {
   std::string inputPath;
   std::string outputPath;
   std::string algoName;
-
+  SESAME::evaluateType evaluateType;
 };
 
 class BenchmarkUtils {
diff --git a/src/Evaluation/Evaluation.cpp b/src/Evaluation/Evaluation.cpp
index 72c2a2ef..ada4dcd1 100644
--- a/src/Evaluation/Evaluation.cpp
+++ b/src/Evaluation/Evaluation.cpp
@@ -1,8 +1,5 @@
 // Copyright (C) 2021 by the IntelliStream team (https://github.com/intellistream)
 
-//
-// Created by Shuhao Zhang on 26/07/2021.
-//
 #include <Evaluation/Evaluation.hpp>
 #include <cmath>
 #include <Utils/Logger.hpp>
diff --git a/src/Sources/DataSource.cpp b/src/Sources/DataSource.cpp
index 947995f3..5a6b1d55 100644
--- a/src/Sources/DataSource.cpp
+++ b/src/Sources/DataSource.cpp
@@ -89,4 +89,7 @@ void SESAME::DataSource::setBarrier(SESAME::BarrierPtr barrierPtr) {
 SESAME::DataSource::~DataSource() {
   stop();
 }
+vector<SESAME::PointPtr> SESAME::DataSource::getInputs() {
+  return input;
+}
 
diff --git a/src/Utils/BenchmarkUtils.cpp b/src/Utils/BenchmarkUtils.cpp
index b6012798..ff5c7022 100644
--- a/src/Utils/BenchmarkUtils.cpp
+++ b/src/Utils/BenchmarkUtils.cpp
@@ -140,16 +140,17 @@ void BenchmarkUtils::defaultParam(param_t &cmd_params) {
   cmd_params.maxLeafNodes = 3;
   cmd_params.maxInternalNodes = 3;
   cmd_params.thresholdDistance = 6550;
-  cmd_params.minPoints=10;
-  cmd_params.epsilon=50;
-  cmd_params.base=2;
-  cmd_params.lambda=1.8;
-  cmd_params.mu=7;
-  cmd_params.beta=5;
+  cmd_params.minPoints = 10;
+  cmd_params.epsilon = 50;
+  cmd_params.base = 2;
+  cmd_params.lambda = 1.8;
+  cmd_params.mu = 7;
+  cmd_params.beta = 5;
   cmd_params.inputPath = std::filesystem::current_path().generic_string() + "/datasets/CoverType.txt";
   SESAME_INFO("Default Input Data Directory: " + cmd_params.inputPath);
   cmd_params.outputPath = "results.txt";
   cmd_params.algoName = "Birch";//StreamKMeans  CluStream Birch
+  cmd_params.evaluateType = SESAME::euclideanCost;
 }
 
 /* command line handling functions */
@@ -200,8 +201,17 @@ void BenchmarkUtils::runBenchmark(param_t &cmd_params,
 
   //Store results.
   algoPtr->store(cmd_params.outputPath, cmd_params.dimension, sinkPtr->getResults());
-  SESAME_INFO("Finished store results: "<<sinkPtr->getResults().size());
-
+  SESAME_INFO("Finished store results: " << sinkPtr->getResults().size());
+
+  switch (cmd_params.evaluateType) {
+    case SESAME::euclideanCost:
+      SESAME::Evaluation::euclideanCost(cmd_params.pointNumber,
+                                        sinkPtr->getResults().size(),
+                                        cmd_params.dimension,
+                                        sourcePtr->getInputs(),
+                                        sinkPtr->getResults());
+      break;
+  }
   engine.stop();
 }
 


Test patch:
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 575bebd9..348c166a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,9 +1,9 @@
 # adding the Google_Tests_run target
 add_executable(Google_Tests_run
         SystemTest/DenStreamTest.cpp
-        #SystemTest/CluStreamTest.cpp
-       # SystemTest/StreamKMTest.cpp
-        #SystemTest/BirchTest.cpp
+        SystemTest/CluStreamTest.cpp
+        SystemTest/StreamKMTest.cpp
+        SystemTest/BirchTest.cpp
         )
 
 # linking Google_Tests_run with sesame_lib which will be tested