the assignment of least cost of the \( k \) rows \( 0 , \ldots ,
k - 1 \) of \( g \) to its \( k \) columns \( k , \ldots ,
2 k - 1 \), the weights of the edges between them the costs, kept up to date [see Assignment.h]
More...
#include <ADS/graph/Reoptimization.h>
|
| using | Weight = typename G::Weight |
| | the type of the weights
|
| using | Event |
| | the type of the events
|
| using | Policy |
| | the type of the policy
|
|
| | AssignmentObserver (const G &g, int k) |
| | the assignment of the \( k \) rows of \( g \), computed at the first query; a pair with no edge is forbidden
|
| void | solve (void) |
| | brings the assignment up to date
|
| Assignment< Weight > & | assignment (void) |
| | the assignment, up to date
|
| int | partner (int i) |
| | the column, in \( [ k , 2 k ) \), of the row \( i \), \( -1 \) if none
|
| Weight | total (void) |
| | the total cost of the assignment
|
| P & | policy (void) |
| | the recompute policy, that of the Assignment, which weighs the events only through the rows and the columns that they touch
|
| const P & | policy (void) const |
| | the recompute policy
|
| ReoptStats | reoptStats (std::size_t k) const |
| | the statistics of a query after \( k \) more events, for the policy: the events queued and the \( k^2 \) costs
|
| void | apply (const Event &e) |
| | queues \( e \), unless Rebuilt came since the last query
|
| void | notify (const Event &e) |
| | apply( e ), for the Observable
|
| void | on (const mod::Rebuilt &) noexcept |
| | forgets the queue, and takes no event until the next query, which computes the solution from scratch
|
| std::size_t | pending (void) const |
| | the events waiting for the next query
|
| int | outcome (void) const |
| | how the last solve() with events to apply, or with no solution yet, did it [see Reopt]
|
| int | cause (void) const |
| | why: the cause of the last outcome [see Reopt]
|
| long long | count (int outcome) const |
| | the solves of each outcome so far
|
| long long | byCause (int c) const |
| | the solves of each cause so far
|
| P & | policy (void) |
| | the recompute policy
|
| void | setRecomputeRatio (double ratio) |
| | from scratch when the events coalesced exceed \( \mathit{ratio} \) times the edges: \( \rho \) of the policy
|
|
| static constexpr unsigned | mask (void) |
| | all the kinds of event
|
| std::vector< Event > | take (void) |
| | the queue coalesced, emptied
|
| bool | tooMany (std::size_t k, long long m) |
| | whether the policy wants \( k \) events on \( m \) edges from scratch
|
| bool | fresh (bool ready) |
| | whether a solve from scratch is due before any event: no solution yet, or Rebuilt; the queue then emptied
|
| void | tally (int cause) |
| | the cause of a solve() counted, not told to the policy
|
| void | done (int cause, double w) |
| | the cause of a solve() counted and told to the policy with the work \( w \)
|
| static ReoptStats | stats (std::size_t k, long long m) |
| | the statistics of \( k \) events on \( m \) edges
|
| std::vector< Event > | f_q |
| | the events queued
|
| P | f_policy |
| | the recompute policy
|
| bool | f_stale |
| | whether Rebuilt came
|
| int | f_outcome |
| | the last outcome
|
| int | f_cause |
| | the last cause
|
| long long | f_count [3] |
| | the solves by outcome
|
| long long | f_byCause [Reopt::CAUSES] |
| | the solves by cause
|
template<Graph G, ReoptPolicy P = RatioPolicy>
requires std::is_arithmetic_v< typename G::Weight >
class ADS::AssignmentObserver< G, P >
the assignment of least cost of the \( k \) rows \( 0 , \ldots ,
k - 1 \) of \( g \) to its \( k \) columns \( k , \ldots ,
2 k - 1 \), the weights of the edges between them the costs, kept up to date [see Assignment.h]
◆ Weight
template<Graph G, ReoptPolicy P = RatioPolicy>
◆ AssignmentObserver()
template<Graph G, ReoptPolicy P = RatioPolicy>
the assignment of the \( k \) rows of \( g \), computed at the first query; a pair with no edge is forbidden
- Precondition
- \( k \ge 0 \), the nodes of \( g \) are \( 0 , \ldots , 2 k - 1 \), each edge between a row and a column
◆ assignment()
template<Graph G, ReoptPolicy P = RatioPolicy>
the assignment, up to date
◆ partner()
template<Graph G, ReoptPolicy P = RatioPolicy>
the column, in \( [ k , 2 k ) \), of the row \( i \), \( -1 \) if none
- Precondition
- \( i \in [ 0 , k ) \)
◆ policy() [1/2]
template<Graph G, ReoptPolicy P = RatioPolicy>
the recompute policy, that of the Assignment, which weighs the events only through the rows and the columns that they touch
◆ policy() [2/2]
template<Graph G, ReoptPolicy P = RatioPolicy>
◆ reoptStats()
template<Graph G, ReoptPolicy P = RatioPolicy>
the statistics of a query after \( k \) more events, for the policy: the events queued and the \( k^2 \) costs
◆ solve()
template<Graph G, ReoptPolicy P = RatioPolicy>
brings the assignment up to date
In pseudocode (beyond the book), the events \( P \) coalesced given to the Assignment [see Assignment::solve()]:
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{procedure}\ \mathrm{solve}() \cr
2 & \quad \textbf{if}\ \mathrm{Rebuilt}\ \text{came}\ \textbf{then}
\ \text{every row of } c \text{ again from } g \cr
3 & \quad \textbf{foreach}\ ( i , k + j ) \text{ from } w \text{ to }
w' \text{ in } P\ \textbf{do}\ c( i , j ) \gets w' \text{, or }
\infty \text{ if deleted} \cr
4 & \quad A.\mathrm{solve}()
\end{array}}
\]
◆ total()
template<Graph G, ReoptPolicy P = RatioPolicy>
the total cost of the assignment
The documentation for this class was generated from the following file: