diff --git a/example pdfs/example_concat_pushes.pdf b/example pdfs/example_concat_pushes.pdf index 7f38cc2657e4d53f0c17ef26184b0bdc2bbf68ae..d8cce15a862e1c195fb0518a31042f0bb358b36f 100644 Binary files a/example pdfs/example_concat_pushes.pdf and b/example pdfs/example_concat_pushes.pdf differ diff --git a/example_basic.cpp b/example_basic.cpp index 5600266fbb6866038ade8b756c2b101ed693bf8f..281650b2bb2d17a957aa647188500bd3b9150973 100644 --- a/example_basic.cpp +++ b/example_basic.cpp @@ -1,4 +1,4 @@ -{// change the #include in exec.cpp if you want this example to be executed! +{// change the INSTANCE in preprocessor_compile_control.cpp if you want this example to be executed! // populate Graph // set accordingly before initializing! nodes.reserve(4); @@ -9,7 +9,7 @@ nodes.push_back(new Node(2,-1.5)); nodes.push_back(new Node(2,1.5)); nodes.push_back(new Node(4,0)); - + edges.push_back(new Edge(nodes[0],nodes[1],Edge::MonotonousConst({0,1,2,5},{2,3,7}),0,5,-3.5)); edges.push_back(new Edge(nodes[0],nodes[2],Edge::MonotonousConst({0,1,2},{3,4}),0,2,3.5)); edges.push_back(new Edge(nodes[1],nodes[2],Edge::MonotonousConst({0,1},{1}),0,1,3.5)); diff --git a/example_concat_pushes.cpp b/example_concat_pushes.cpp index 67cd45dfc96325214f85db77ae5b40dad3bfecc9..5e602f315608db235ddeb783960e8cd26b90d334 100644 --- a/example_concat_pushes.cpp +++ b/example_concat_pushes.cpp @@ -1,4 +1,4 @@ -{// change the #include in exec.cpp if you want this example to be executed! +{// change the INSTANCE in preprocessor_compile_control.cpp if you want this example to be executed! // populate Graph // set accordingly before initializing! nodes.reserve(3); @@ -9,9 +9,9 @@ nodes.push_back(new Node(0,0)); nodes.push_back(new Node(4,0)); - edges.push_back(new Edge(nodes[2],nodes[0],Edge::MonotonousConst({1,3},{-1}),1,3,-3.5,{{2,0}})); edges.push_back(new Edge(nodes[0],nodes[2],Edge::MonotonousConst({0,3},{1}),0,3,-3.5)); edges.push_back(new Edge(nodes[1],nodes[0],Edge::MonotonousConst({0,1,2,5},{2,3,7}),0,5,-3.5)); + edges.push_back(new Edge(nodes[2],nodes[0],Edge::MonotonousConst({0,1,3},{-1,5}),0,3,-3.5,{{2,0}})); // target to source edges.push_back(new Edge(nodes[2],nodes[1],Edge::MonotonousConst({1,2},{-9}),1,2,-3.5,{{4,2.5},{-.5,2.5},{-.5,1.5/4}})); } diff --git a/example_no_circ_existent.cpp b/example_no_circ_existent.cpp index e3c60b7b15cb46700752d45873af05a6158190e0..08efc64445c3421e367d068cc73081822f30df50 100644 --- a/example_no_circ_existent.cpp +++ b/example_no_circ_existent.cpp @@ -1,4 +1,4 @@ -{// change the #include in exec.cpp if you want this example to be executed! +{// change the INSTANCE in preprocessor_compile_control.cpp if you want this example to be executed! // populate Graph // set accordingly before initializing! nodes.reserve(4); diff --git a/exec.cpp b/exec.cpp index cb8d7167a18ea2751f321718e027b901bb642e5f..5671c15003ccb1ca033774e2570fe35c6b202061 100644 --- a/exec.cpp +++ b/exec.cpp @@ -1,3 +1,4 @@ +#include "preprocessor_compile_control.h" #include "Graph.h" #include "alg.cpp" #include <climits> @@ -6,7 +7,7 @@ int main(){ - Graph g = Graph(std::vector<Node*>(), std::vector<Edge*>(), "example"); + Graph g = Graph(std::vector<Node*>(), std::vector<Edge*>(), INSTANCE); std::vector<Node*>& nodes = g.get_nodes(); std::vector<Edge*>& edges = g.get_edges(); @@ -15,8 +16,10 @@ int main(){ #endif { - #include "example_concat_pushes.cpp" + #define DOT(x,y) x.y + #include TOSTRING(DOT(example_concat_pushes,cpp)) } + #ifndef SUPPRESS_PROTOCOL std::cout << "\033[31mthe graph is given by:\033[39m"<< std::endl << std::endl; std::cout << g << std::endl; diff --git a/preprocessor_compile_control.h b/preprocessor_compile_control.h index 33bdf6df4db305e115ff9773fb201314662867fa..ce22956c2ab38cb44dd9870cacc5272b15de6183 100644 --- a/preprocessor_compile_control.h +++ b/preprocessor_compile_control.h @@ -1,29 +1,25 @@ -#ifndef SUPPRESS_PROTOCOL +#ifndef PREPROCESSOR_COMPILE_CONTROL_H /* * delete following line if a protocol should be generated */ -//#define SUPPRESS_PROTOCOL +#define SUPPRESS_PROTOCOL + -#endif -#ifndef CHECK_ASSERT /* delete following line if basic assertions should not be checked (for testing) leads to asymptotically worse runtime! */ //#define CHECK_ASSERT -#endif - -#ifndef PEDANTIC_LABELING /* delete if cost and residual capacity should not be given on edges of tikzpictures @@ -31,13 +27,11 @@ */ //#define PEDANTIC_LABELING -#endif -#ifndef DRAW_IMPROVING_EDGES /* delete if tikz edges should always be drawn from get_a() to get_b() Otherwise it will be drawn s.t. the edge has non positive get_residual_cost @@ -47,11 +41,22 @@ */ //#define DRAW_IMPROVING_EDGES -#endif -#ifndef ATTRIBUTION + + + +#define STRINGIFIY(x) #x +#define TOSTRING(x) STRINGIFIY(x) +#define CONCAT(x,y) x ## y /* Variable used to credit on slides */ -#define ATTRIBUTION "https://git.rwth-aachen.de/goseminarss2020/convex-cost-scaling-algorithm-visualization" +#define ATTRIBUTION "https://git.rwth-aachen.de/goseminarss2020/convex-cost-scaling-algorithm-visualization" + +/* + will execute initialization of INSTANCE##".cpp" (see exec.cpp) +*/ + +#define INSTANCE TOSTRING(example_concat_pushes) + #endif