1 #ifndef __MINLCA_MINLCA_GREEDY_LP_HH
2 #define __MINLCA_MINLCA_GREEDY_LP_HH
22 template<
typename Graph = lemon::SmartGraph>
26 friend class lemon::BfsVisit<Graph, MinLCAGreedyLp<Graph>>;
29 TEMPLATE_GRAPH_TYPEDEFS(Graph);
56 std::vector<bool> colours(
_max_k,
true);
58 for (IncEdgeIt e(
_g, v); e != lemon::INVALID; ++e) {
59 Node n =
_g.oppositeNode(v, e);
63 colours[nColour] =
false;
70 for (
int i = 0; i <
_max_k and vColour == -1; ++i) {
71 int currentColour = colourOrder[i];
73 if (colours[currentColour]) {
74 vColour = currentColour;
84 template<
typename Graph = lemon::SmartGraph>
virtual MinLCAStatus run()
Run the algorithm.
Class defining a relaxed linear programming model for MinLCA.
virtual void setColour(const Node &v, int vColour)
Set the colour of a vertex.
MinLCAStatus
Possible status for MinLCA solution.
Base class for greedy algorithms.
const Graph & _g
A const reference to the graph we want to arrange.
int _k
Largest index of the colours used.
virtual void paintVertex(const Node &v)
Assign a colour to a vertex using a greedy approach.
Colouring _c
The vertex colouring.
Default namespace Default namespace for MinLCA algorithms.
Class for greedy algorithms using a breadth-first search.
int _max_k
Maximum number of colours allowed.
MinLCAGreedy< Graph > Base
The greedy base class.
Defines the relaxed linear programming model for MinLCA.
Use the MinLCAGreedyLp with Bfs.
Use the relaxed linear model as a base for colour preferences.
double solve()
Solve the linear model.
MinLCAGreedyLp(const Graph &g, int maxK=0)
Constructor.
MinLCALpModel< Graph > model
Relaxed linear model for the graph.
int maxK()
Maximum number of allowed colours.
std::vector< int > getColourOrder(const Node &v)
Get the colour preference induced by the solution.
long long _lca
Cost of the current solution.
MinLCAGreedyLpBfs(const Graph &g, int maxK=0)
Constructor.