diff --git a/test/bnb_test.cpp b/test/bnb_test.cpp index 3d0c72e49cb9b8cf4aef78f9ae81b86e99b12691..834792917bdf7c0c775c50af3bd13582bc15b736 100644 --- a/test/bnb_test.cpp +++ b/test/bnb_test.cpp @@ -1,10 +1,41 @@ #include <catch2/catch.hpp> #include <gp-bnb/graph.hpp> -//#include <gp-bnb/MetisReader.hpp> +#include <gp-bnb/metis_reader.hpp> +#include <gp-bnb/bnb.hpp> // Tests for Branch&Bound algorithm TEST_CASE("BnbTest") { + //test partitioning of tiny graph + std::string graph = "../test/inputs/tiny_01.graph"; + auto g = metis_reader().read(graph); + + auto sol = gp_bnb::solver(g); + sol.solve(); + std::vector<partition::subgraph> f= sol.best_solution(); + + REQUIRE(f[0] == -1); + REQUIRE(f[1] == -1); + REQUIRE(f[2] == -1); + REQUIRE(f[3] == 1); + REQUIRE(f[4] == -1); + REQUIRE(f[5] == 1); + REQUIRE(f[6] == 1); + + std::vector<std::vector<unsigned int>> a; + a ={ + {5, 2, 3}, + {1, 3, 4}, + {5, 4, 2, 1}, + {2, 3, 6, 7}, + {1, 3, 6}, + {5, 4, 7}, + {6, 4}, + }; + + + + } \ No newline at end of file