Skip to content
Snippets Groups Projects
Commit 8b247e75 authored by Jonas Seidel's avatar Jonas Seidel
Browse files

streamlining example / changing include system

parent 0e69551d
No related branches found
No related tags found
No related merge requests found
No preview for this file type
{// 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));
......
{// 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}}));
}
{// 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);
......
#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;
......
#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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment