athos@610: #include athos@610: #include athos@610: #include alpar@790: //#include athos@611: #include "test_tools.h" athos@610: athos@610: using namespace std; athos@610: using namespace hugo; athos@610: athos@610: athos@610: athos@610: bool passed = true; athos@610: athos@610: athos@610: int main() athos@610: { athos@610: athos@610: typedef ListGraph::Node Node; athos@610: typedef ListGraph::Edge Edge; athos@610: athos@610: ListGraph graph; athos@610: athos@610: //Ahuja könyv példája athos@610: athos@610: Node s=graph.addNode(); athos@610: Node v1=graph.addNode(); athos@610: Node v2=graph.addNode(); athos@610: Node v3=graph.addNode(); athos@610: Node v4=graph.addNode(); athos@610: Node v5=graph.addNode(); athos@610: Node t=graph.addNode(); athos@610: athos@610: Edge s_v1=graph.addEdge(s, v1); athos@610: Edge v1_v2=graph.addEdge(v1, v2); athos@610: Edge s_v3=graph.addEdge(s, v3); athos@610: Edge v2_v4=graph.addEdge(v2, v4); athos@610: Edge v2_v5=graph.addEdge(v2, v5); athos@610: Edge v3_v5=graph.addEdge(v3, v5); athos@610: Edge v4_t=graph.addEdge(v4, t); athos@610: Edge v5_t=graph.addEdge(v5, t); athos@610: athos@610: athos@610: ListGraph::EdgeMap length(graph); athos@610: athos@610: length.set(s_v1, 6); athos@610: length.set(v1_v2, 4); athos@610: length.set(s_v3, 10); athos@610: length.set(v2_v4, 5); athos@610: length.set(v2_v5, 1); athos@610: length.set(v3_v5, 5); athos@610: length.set(v4_t, 8); athos@610: length.set(v5_t, 8); athos@610: athos@610: std::cout << "Minlengthpaths algorithm test..." << std::endl; athos@610: athos@610: athos@610: int k=3; athos@610: MinLengthPaths< ListGraph, ListGraph::EdgeMap > athos@610: surb_test(graph, length); athos@610: alpar@791: check( surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 46, alpar@791: "Two paths, total length should be 46"); athos@610: alpar@791: check( surb_test.checkComplementarySlackness(), alpar@791: "Complementary slackness conditions are not met."); athos@610: alpar@790: // typedef DirPath DPath; alpar@790: // DPath P(graph); athos@610: athos@610: /* athos@610: surb_test.getPath(P,0); athos@610: check(P.length() == 4, "First path should contain 4 edges."); athos@610: cout<