2.2.9.2. causality/Flow.hpp¶
2.2.9.2.1. Class causality::FlowQuery¶
-
class
causality::FlowQuery¶ Representation of a query for a DAG that can be folded back into a given flow. The query is based on a derivation graph and can thus be used for any flow solution from a model based on that derivation graph.
2.2.9.2.1.1. Synopsis¶
struct MOD_DECL FlowQuery {
explicit FlowQuery(std::shared_ptr<dg::DG> dg_);
MOD_DECL friend std::ostream &operator<<(std::ostream &s, const FlowQuery &q);
std::shared_ptr<dg::DG> getDG() const;
void setMultiplicity(int multiplicity);
int getMultiplicity() const;
void setBorrow(dg::DG::Vertex v, int count);
int getBorrow(dg::DG::Vertex v) const;
void setBorrow(std::shared_ptr<graph::Graph> g, int count);
int getBorrow(std::shared_ptr<graph::Graph> g) const;
void setConstrainRouting(bool v);
bool getConstrainRouting() const;
public:
boost::optional<DAG> findDAG(const flow::Solution &s) const;
boost::optional<DAG> findDAG(const flow::SolutionOld &s) const;
public:
// TODO: remove once the old flow solutions are gone
lib::causality::FlowQuery getQuery() const;
private:
std::shared_ptr<dg::DG> dg_;
int multiplicity = 1;
std::map<dg::DG::Vertex, int> borrow;
bool constrainRouting = true;
};
2.2.9.2.1.2. Details¶
Construct a query with multiplicity 1 and no borrowing.
- Throws
LogicErrorifdg_is null.
-
void
setMultiplicity(int multiplicity)¶ -
int
getMultiplicity() const¶ Set/get the multiplicity of the query. It must be at least 1.
- Throws
(set)
LogicErrorifmultiplicity < 1.
-
void
setBorrow(dg::DG::Vertex v, int count)¶ -
int
getBorrow(dg::DG::Vertex v) const¶ Set/get the amount of flow allowed to be borrowed at the vertex represented by the graph.
- Throws
LogicErrorif!v.- Throws
LogicErrorifv.getDG() != getDG().- Throws
(set)
LogicErrorifcount < 0.
-
void
setConstrainRouting(bool v)¶ -
bool
getConstrainRouting() const¶ Set/get whether transit edges must conform to the routing expressed by the flow. Setting this to
falsemay give sequences violating flow constraints.
-
boost::optional<DAG>
findDAG(const flow::Solution &s) const¶ - Returns
a causality DAG that can be folded back into the given flow solution, using the query settings in this object, if one can be found.
- Throws
LogicErrorif any graphggiven tosetBorrow()with non-zero count is not a vertex in the underlying derivation graph of the given flow solution, i.e., ifs.getFlow()->getDG()->findVertex(g)returns a null vertex.