3.2.11.4. causality/FlowQuery.hpp

3.2.11.4.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.

3.2.11.4.1.1. Synopsis

explicit FlowQuery(std::shared_ptr<dg::DG> dg_)
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
std::optional<DAG> findDAG(const flow::Solution &s) const

3.2.11.4.1.2. Details

explicit FlowQuery(std::shared_ptr<dg::DG> dg_)

Construct a query with multiplicity 1 and no borrowing.

Throws

LogicError if dg_ is null.

std::shared_ptr<dg::DG> getDG() const
Returns

the underlying derivation graph.

void setMultiplicity(int multiplicity)
int getMultiplicity() const

Set/get the multiplicity of the query. It must be at least 1.

Throws

(set) LogicError if multiplicity < 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

LogicError if !v.

Throws

LogicError if v.getDG() != getDG().

Throws

(set) LogicError if count < 0.

void setBorrow(std::shared_ptr<graph::Graph> g, int count)
int getBorrow(std::shared_ptr<graph::Graph> g) const

Calls the corresponding functions with the result of getDG()->findVertex(g).

void setConstrainRouting(bool v)
bool getConstrainRouting() const

Set/get whether transit edges must conform to the routing expressed by the flow. Setting this to false may give sequences violating flow constraints.

std::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

LogicError if any graph g given to setBorrow() with non-zero count is not a vertex in the underlying derivation graph of the given flow solution, i.e., if s.getFlow()->getDG()->findVertex(g) returns a null vertex.