Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType > Class Template Reference

Helper class to verify that an optimal solution has been found. More...

#include <blossom_weighted_mwmatching.H>

Collaboration diagram for Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >:
[legend]

Public Member Functions

 MatchingVerifier (const MatchingContext< WeightType > &ctx)
 
bool verify ()
 Verify that the optimum solution has been found.
 

Private Types

using EdgeT = Edge< WeightType >
 
using BlossomT = Blossom< WeightType >
 
using NonTrivialBlossomT = NonTrivialBlossom< WeightType >
 

Private Member Functions

std::size_t edge_index (const EdgeT *edge)
 Convert edge pointer to its index in the array "edges".
 
bool verify_vertex_mate ()
 Check that the array "vertex_mate" is consistent.
 
bool verify_vertex_duals ()
 Check that vertex dual variables are non-negative, and all unmatched vertices have zero dual.
 
bool verify_blossom_duals ()
 Check that blossom dual variables are non-negative.
 
bool check_blossom (const NonTrivialBlossomT *blossom)
 Helper function for verifying the solution.
 
bool verify_blossoms_and_calc_edge_duals ()
 Check that all blossoms are full.
 
bool verify_edge_slack ()
 Check that all edges have non-negative slack, and check that all matched edges have zero slack.
 

Static Private Member Functions

static bool checked_add (WeightType &result, WeightType a, WeightType b)
 

Private Attributes

const MatchingContext< WeightType > & ctx
 Reference to the MatchingContext instance.
 
const Problem_Data< WeightType > & graph
 Reference to the input graph.
 
Array< WeightTypeedge_duals
 For each edge, the sum of duals of its incident vertices and duals of all blossoms that contain the edge.
 

Detailed Description

template<typename WeightType>
class Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >

Helper class to verify that an optimal solution has been found.

Definition at line 1768 of file blossom_weighted_mwmatching.H.

Member Typedef Documentation

◆ BlossomT

◆ EdgeT

◆ NonTrivialBlossomT

Constructor & Destructor Documentation

◆ MatchingVerifier()

Member Function Documentation

◆ check_blossom()

Helper function for verifying the solution.

Descend down the blossom tree to find edges that are contained in blossoms.

On the way down, keep track of the sum of dual variables of containing blossoms. Add blossom duals to edges that are contained inside blossoms.

On the way up, keep track of the total number of matched edges in subblossoms. Check that all blossoms with non-zero dual variables are "full".

Returns
True if successful; false if a blossom with non-zero dual is not full; false if blossom dual calculations cause numeric overflow.

Definition at line 1885 of file blossom_weighted_mwmatching.H.

References Aleph::Array< T >::append(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::checked_add(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::ctx, Aleph::divide_and_conquer_partition_dp(), Aleph::blossom_weighted_detail::mwmatching::impl::NonTrivialBlossom< WeightType >::dual_var, Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::edge_duals, Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::edge_index(), Aleph::blossom_weighted_detail::mwmatching::impl::for_vertices_in_blossom(), Aleph::DynListStack< T >::get(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::graph, Aleph::DynListStack< T >::is_empty(), Aleph::DynListStack< T >::put(), Aleph::Array< T >::reserve(), Aleph::DynListStack< T >::size(), Aleph::blossom_weighted_detail::mwmatching::impl::NonTrivialBlossom< WeightType >::subblossoms, Aleph::DynListStack< T >::top(), Aleph::blossom_weighted_detail::mwmatching::Edge< WeightType >::vt, and y.

Referenced by Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::verify_blossoms_and_calc_edge_duals().

◆ checked_add()

◆ edge_index()

◆ verify()

◆ verify_blossom_duals()

◆ verify_blossoms_and_calc_edge_duals()

◆ verify_edge_slack()

◆ verify_vertex_duals()

◆ verify_vertex_mate()

Member Data Documentation

◆ ctx

◆ edge_duals

◆ graph


The documentation for this class was generated from the following file: