-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRandomGraph.h
37 lines (28 loc) · 1.07 KB
/
RandomGraph.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef RANDOMGRAPH_H_INCLUDED
#define RANDOMGRAPH_H_INCLUDED
#include "Network.h"
//saves the change done to a network
//either an edge was changed or two b_values
struct Action {
Action (Edge _oldE, Edge _newE) : oldE(_oldE), newE(_newE), edgeCase(true) {};
Action (std::tuple<size_t, size_t, intmax_t> _b_change) : b_change(_b_change), edgeCase(false) {};
Edge oldE, newE;
std::tuple<size_t, size_t, intmax_t> b_change;
bool edgeCase;
};
class RandomGraph {
public:
RandomGraph (Network _n) : n(_n), networkSave(_n) {};
//create an somehow evenly distributed network
RandomGraph (size_t maxNoNodes, intmax_t maxFlow, intmax_t maxCost);
Network getNetwork();
//just random moves and saves the optimum under all networks
void evolve (size_t steps);
//somewhat more sophisticated
void smartEvolve (size_t steps, std::vector<double> distribution);
private:
Network n = Network(0), networkSave = Network(0);
std::vector<Action> takenActions;
std::pair<size_t, size_t> randomMissingEdge();
};
#endif // RANDOMGRAPH_H_INCLUDED