From b95fd81c9b1120b4dd2dfced235724819a02c856 Mon Sep 17 00:00:00 2001 From: Navid Nasyry <65495118+navidnasyry@users.noreply.github.com> Date: Sun, 14 Aug 2022 02:17:49 +0430 Subject: [PATCH] create testMainWithPoint.cpp create testMainWithPoint.cpp file that support start and goal points in algorithm --- testMainWithPoint.cpp | 124 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 testMainWithPoint.cpp diff --git a/testMainWithPoint.cpp b/testMainWithPoint.cpp new file mode 100644 index 0000000..b5c7bd8 --- /dev/null +++ b/testMainWithPoint.cpp @@ -0,0 +1,124 @@ +#include +#include "Hungarian.h" +#include +using namespace std; + + +vector> find_distance_table(int number_of_point, float x_start[], float y_start[], float z_start[], float x_goal[], float y_goal[], float z_goal[]) +{ + + vector> distance_table(number_of_point, vector (number_of_point, 0)); + for(int i=0 ; i assignment, float x_goal[], float y_goal[], float z_goal[]) +{ + + + float* x_goal_copy = new float(number_of_point); + float* y_goal_copy = new float(number_of_point); + float* z_goal_copy = new float(number_of_point); + + for(int i=0 ; i > costMatrix ={{ 92, 90, 61, 42}, + // { 90, 92, 81, 61 }, + // { 24, 14, 108, 98}, + // { 14, 24, 120, 108} }; + + vector< vector > costMatrix = find_distance_table(number_of_point, x_start, y_start, z_start, x_goal, y_goal, z_goal); + + HungarianAlgorithm HungAlgo; + vector assignment; + + double cost = HungAlgo.Solve(costMatrix, assignment); + + change_order_of_goals(number_of_point, assignment, x_goal, y_goal, z_goal); + + + cout << "\n\nOutput : \n\n"; + for(int i=0 ; i