Vcsn
2.0
Be Rational
|
#include <are-isomorphic.hh>
Classes | |
struct | full_response |
A datum specifying if two given automata are isomorphic, and why if they are not. More... | |
Public Types | |
using | states1_t = std::vector< state1_t > |
using | states2_t = std::vector< state2_t > |
using | class_id = std::size_t |
Automaton states partitioned into classes. More... | |
using | class_pair_t = std::pair< states1_t, states2_t > |
using | state_classes_t = std::vector< class_pair_t > |
using | origins_t = std::map< state2_t, state1_t > |
A map from each a2_ state to the corresponding a1_ state. More... | |
Public Member Functions | |
are_isomorphicer (const Aut1 &a1, const Aut2 &a2) | |
const full_response | get_full_response () |
template<typename Automaton > | |
class_id | state_to_class (state_t_of< Automaton > s, Automaton &a) |
const state_classes_t | make_state_classes () |
void | print_class_stats (const state_classes_t &cs) |
Handy debugging method. More... | |
void | print_classes (const state_classes_t &cs) |
Handy debugging method. More... | |
bool | is_isomorphism_valid () |
bool | is_isomorphism_valid_throwing () |
void | update_result_isomorphism () |
long | factorial (long n) |
void | initialize_next_class_combination_state () |
bool | next_class_combination () |
const full_response | get_full_response_nonsequential () |
const full_response | get_full_response_sequential () |
bool | operator() () |
origins_t | origins () |
Only meaningful if operator() returned true. More... | |
Static Public Member Functions | |
static std::ostream & | print (const origins_t &orig, std::ostream &o) |
Print origins. More... | |
Public Attributes | |
state_classes_t | state_classes_ |
std::vector< long > | class_permutation_max_ |
We need to keep some (small) state between a next_class_combination call and the next. More... | |
std::vector< long > | class_permutation_generated_ |
Private Types | |
using | automaton1_t = Aut1 |
using | context1_t = context_t_of< automaton1_t > |
using | weightset1_t = weightset_t_of< automaton1_t > |
using | labelset1_t = labelset_t_of< context1_t > |
using | state1_t = state_t_of< automaton1_t > |
using | label1_t = label_t_of< automaton1_t > |
using | weight1_t = weight_t_of< automaton1_t > |
using | transition1_t = transition_t_of< automaton1_t > |
using | automaton2_t = Aut2 |
using | context2_t = context_t_of< automaton2_t > |
using | weightset2_t = weightset_t_of< automaton1_t > |
using | labelset2_t = labelset_t_of< context2_t > |
using | state2_t = state_t_of< automaton2_t > |
using | label2_t = label_t_of< automaton2_t > |
using | weight2_t = weight_t_of< automaton2_t > |
using | transition2_t = transition_t_of< automaton2_t > |
using | weightset_t = weightset1_t |
using | labelset_t = labelset1_t |
using | states_t = std::pair< state1_t, state2_t > |
template<typename Automaton > | |
using | dout_t = std::unordered_map< state_t_of< Automaton >, std::unordered_map< label_t_of< Automaton >, std::pair< weight_t_of< Automaton >, state_t_of< Automaton >>, vcsn::hash< labelset_t_of< Automaton >>, vcsn::equal_to< labelset_t_of< Automaton >>>> |
See the comment for out_ in minimize.hh. More... | |
template<typename Automaton > | |
using | nout_t = std::unordered_map< state_t_of< Automaton >, std::unordered_map< label_t_of< Automaton >, std::unordered_map< weight_t_of< Automaton >, std::vector< state_t_of< Automaton >>, vcsn::hash< weightset_t_of< Automaton >>, vcsn::equal_to< weightset_t_of< Automaton >>>, vcsn::hash< labelset_t_of< Automaton >>, vcsn::equal_to< labelset_t_of< Automaton >>>> |
For the nonsequential case. More... | |
using | pair_t = std::pair< state1_t, state2_t > |
A worklist of pairs of states which are candidate to be isomorphic. More... | |
using | worklist_t = std::stack< pair_t > |
using | s1tos2_t = std::unordered_map< state1_t, state2_t > |
The maps associating the states of a1_ and the states of a2_-> More... | |
using | s2tos1_t = std::unordered_map< state2_t, state1_t > |
Private Member Functions | |
template<typename Automaton > | |
bool | is_sequential_filling (const Automaton &a, dout_t< Automaton > &dout) |
void | fill_nouts_ () |
void | clear () |
bool | trivially_different () |
Private Attributes | |
const Aut1 & | a1_ |
const Aut2 & | a2_ |
dout_t< automaton1_t > | dout1_ |
For the simpler, faster sequential case. More... | |
dout_t< automaton2_t > | dout2_ |
nout_t< automaton1_t > | nout1_ |
nout_t< automaton2_t > | nout2_ |
worklist_t | worklist_ |
struct vcsn::are_isomorphicer::full_response | fr_ |
Definition at line 30 of file are-isomorphic.hh.
|
private |
Definition at line 33 of file are-isomorphic.hh.
|
private |
Definition at line 42 of file are-isomorphic.hh.
using vcsn::are_isomorphicer< Aut1, Aut2 >::class_id = std::size_t |
Automaton states partitioned into classes.
It's guaranteed that a left[right] state in a given class can not be isomorphic to a right[left] in a different class. The idea of course is to restrict the brute-force search to the states within a single class.
Definition at line 243 of file are-isomorphic.hh.
using vcsn::are_isomorphicer< Aut1, Aut2 >::class_pair_t = std::pair<states1_t, states2_t> |
Definition at line 244 of file are-isomorphic.hh.
|
private |
Definition at line 34 of file are-isomorphic.hh.
|
private |
Definition at line 43 of file are-isomorphic.hh.
|
private |
See the comment for out_ in minimize.hh.
Definition at line 70 of file are-isomorphic.hh.
|
private |
Definition at line 38 of file are-isomorphic.hh.
|
private |
Definition at line 47 of file are-isomorphic.hh.
|
private |
Definition at line 36 of file are-isomorphic.hh.
|
private |
Definition at line 45 of file are-isomorphic.hh.
|
private |
Definition at line 54 of file are-isomorphic.hh.
|
private |
For the nonsequential case.
Definition at line 88 of file are-isomorphic.hh.
using vcsn::are_isomorphicer< Aut1, Aut2 >::origins_t = std::map<state2_t, state1_t> |
A map from each a2_ state to the corresponding a1_ state.
The map is ordered, as usual for origins, hence different from fr_.s2tos1_.
Definition at line 652 of file are-isomorphic.hh.
|
private |
A worklist of pairs of states which are candidate to be isomorphic.
Or "A candidate-isomorphic state pair worklist", written in Reverse-Polish English.
Definition at line 95 of file are-isomorphic.hh.
|
private |
The maps associating the states of a1_ and the states of a2_->
Definition at line 100 of file are-isomorphic.hh.
|
private |
Definition at line 101 of file are-isomorphic.hh.
|
private |
Definition at line 37 of file are-isomorphic.hh.
|
private |
Definition at line 46 of file are-isomorphic.hh.
using vcsn::are_isomorphicer< Aut1, Aut2 >::state_classes_t = std::vector<class_pair_t> |
Definition at line 245 of file are-isomorphic.hh.
using vcsn::are_isomorphicer< Aut1, Aut2 >::states1_t = std::vector<state1_t> |
Definition at line 236 of file are-isomorphic.hh.
using vcsn::are_isomorphicer< Aut1, Aut2 >::states2_t = std::vector<state2_t> |
Definition at line 237 of file are-isomorphic.hh.
|
private |
Definition at line 56 of file are-isomorphic.hh.
|
private |
Definition at line 40 of file are-isomorphic.hh.
|
private |
Definition at line 49 of file are-isomorphic.hh.
|
private |
Definition at line 39 of file are-isomorphic.hh.
|
private |
Definition at line 48 of file are-isomorphic.hh.
|
private |
Definition at line 35 of file are-isomorphic.hh.
|
private |
Definition at line 44 of file are-isomorphic.hh.
|
private |
Definition at line 53 of file are-isomorphic.hh.
|
private |
Definition at line 96 of file are-isomorphic.hh.
|
inline |
Definition at line 196 of file are-isomorphic.hh.
|
inlineprivate |
Definition at line 168 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::dout1_, vcsn::are_isomorphicer< Aut1, Aut2 >::dout2_, vcsn::are_isomorphicer< Aut1, Aut2 >::nout1_, and vcsn::are_isomorphicer< Aut1, Aut2 >::nout2_.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response().
|
inline |
Definition at line 461 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::initialize_next_class_combination_state().
|
inlineprivate |
Definition at line 158 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::a1_, vcsn::are_isomorphicer< Aut1, Aut2 >::a2_, vcsn::are_isomorphicer< Aut1, Aut2 >::nout1_, and vcsn::are_isomorphicer< Aut1, Aut2 >::nout2_.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response().
|
inline |
Definition at line 202 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::a1_, vcsn::are_isomorphicer< Aut1, Aut2 >::a2_, vcsn::are_isomorphicer< Aut1, Aut2 >::clear(), vcsn::are_isomorphicer< Aut1, Aut2 >::dout1_, vcsn::are_isomorphicer< Aut1, Aut2 >::dout2_, vcsn::are_isomorphicer< Aut1, Aut2 >::fill_nouts_(), vcsn::are_isomorphicer< Aut1, Aut2 >::fr_, vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_nonsequential(), vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_sequential(), vcsn::is_accessible(), vcsn::are_isomorphicer< Aut1, Aut2 >::is_sequential_filling(), vcsn::require(), vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::response, vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::trivially_different, and vcsn::are_isomorphicer< Aut1, Aut2 >::trivially_different().
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::operator()().
|
inline |
Definition at line 540 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::fr_, vcsn::are_isomorphicer< Aut1, Aut2 >::initialize_next_class_combination_state(), vcsn::are_isomorphicer< Aut1, Aut2 >::is_isomorphism_valid(), vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::isomorphic, vcsn::are_isomorphicer< Aut1, Aut2 >::make_state_classes(), vcsn::are_isomorphicer< Aut1, Aut2 >::next_class_combination(), vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::nocounterexample, vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::response, vcsn::are_isomorphicer< Aut1, Aut2 >::state_classes_, and vcsn::are_isomorphicer< Aut1, Aut2 >::update_result_isomorphism().
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response().
|
inline |
Definition at line 575 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::a1_, vcsn::are_isomorphicer< Aut1, Aut2 >::a2_, vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::counterexample, vcsn::are_isomorphicer< Aut1, Aut2 >::dout1_, vcsn::are_isomorphicer< Aut1, Aut2 >::dout2_, vcsn::are_isomorphicer< Aut1, Aut2 >::fr_, vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::isomorphic, vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::response, vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::s1tos2_, vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::s2tos1_, and vcsn::are_isomorphicer< Aut1, Aut2 >::worklist_.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response().
|
inline |
Definition at line 474 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::class_permutation_generated_, vcsn::are_isomorphicer< Aut1, Aut2 >::class_permutation_max_, vcsn::are_isomorphicer< Aut1, Aut2 >::factorial(), and vcsn::are_isomorphicer< Aut1, Aut2 >::state_classes_.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_nonsequential().
|
inline |
Definition at line 373 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::is_isomorphism_valid_throwing().
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_nonsequential().
|
inline |
Definition at line 384 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::a1_, vcsn::are_isomorphicer< Aut1, Aut2 >::a2_, vcsn::are_isomorphicer< Aut1, Aut2 >::fr_, vcsn::has(), vcsn::are_isomorphicer< Aut1, Aut2 >::nout1_, vcsn::are_isomorphicer< Aut1, Aut2 >::nout2_, vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::s1tos2_, and vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::s2tos1_.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::is_isomorphism_valid().
|
inlineprivate |
Definition at line 139 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response().
|
inline |
Definition at line 303 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::a1_, vcsn::are_isomorphicer< Aut1, Aut2 >::a2_, vcsn::sort(), and vcsn::are_isomorphicer< Aut1, Aut2 >::state_to_class().
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_nonsequential().
|
inline |
Definition at line 488 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::class_permutation_generated_, vcsn::are_isomorphicer< Aut1, Aut2 >::class_permutation_max_, and vcsn::are_isomorphicer< Aut1, Aut2 >::state_classes_.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_nonsequential().
|
inline |
Definition at line 643 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response(), vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::isomorphic, and vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::response.
|
inline |
Only meaningful if operator() returned true.
Definition at line 656 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::fr_, vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::isomorphic, vcsn::require(), and vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::s2tos1_.
|
inlinestatic |
Print origins.
Definition at line 669 of file are-isomorphic.hh.
|
inline |
Handy debugging method.
Definition at line 340 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::a1_, and vcsn::sum().
|
inline |
Handy debugging method.
Definition at line 359 of file are-isomorphic.hh.
|
inline |
Definition at line 249 of file are-isomorphic.hh.
References HASH_TRANSITIONS, and vcsn::less_than().
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::make_state_classes().
|
inlineprivate |
Definition at line 176 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::a1_, and vcsn::are_isomorphicer< Aut1, Aut2 >::a2_.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response().
|
inline |
Definition at line 449 of file are-isomorphic.hh.
References vcsn::are_isomorphicer< Aut1, Aut2 >::fr_, vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::s1tos2_, vcsn::are_isomorphicer< Aut1, Aut2 >::full_response::s2tos1_, and vcsn::are_isomorphicer< Aut1, Aut2 >::state_classes_.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_nonsequential().
|
private |
Definition at line 58 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::fill_nouts_(), vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response(), vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_sequential(), vcsn::are_isomorphicer< Aut1, Aut2 >::is_isomorphism_valid_throwing(), vcsn::are_isomorphicer< Aut1, Aut2 >::make_state_classes(), vcsn::are_isomorphicer< Aut1, Aut2 >::print_class_stats(), and vcsn::are_isomorphicer< Aut1, Aut2 >::trivially_different().
|
private |
Definition at line 59 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::fill_nouts_(), vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response(), vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_sequential(), vcsn::are_isomorphicer< Aut1, Aut2 >::is_isomorphism_valid_throwing(), vcsn::are_isomorphicer< Aut1, Aut2 >::make_state_classes(), and vcsn::are_isomorphicer< Aut1, Aut2 >::trivially_different().
std::vector<long> vcsn::are_isomorphicer< Aut1, Aut2 >::class_permutation_generated_ |
Definition at line 472 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::initialize_next_class_combination_state(), and vcsn::are_isomorphicer< Aut1, Aut2 >::next_class_combination().
std::vector<long> vcsn::are_isomorphicer< Aut1, Aut2 >::class_permutation_max_ |
We need to keep some (small) state between a next_class_combination call and the next.
Definition at line 471 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::initialize_next_class_combination_state(), and vcsn::are_isomorphicer< Aut1, Aut2 >::next_class_combination().
|
private |
For the simpler, faster sequential case.
Definition at line 73 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::clear(), vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response(), and vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_sequential().
|
private |
Definition at line 74 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::clear(), vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response(), and vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_sequential().
|
private |
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response(), vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_nonsequential(), vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_sequential(), vcsn::are_isomorphicer< Aut1, Aut2 >::is_isomorphism_valid_throwing(), vcsn::are_isomorphicer< Aut1, Aut2 >::origins(), and vcsn::are_isomorphicer< Aut1, Aut2 >::update_result_isomorphism().
|
private |
Definition at line 89 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::clear(), vcsn::are_isomorphicer< Aut1, Aut2 >::fill_nouts_(), and vcsn::are_isomorphicer< Aut1, Aut2 >::is_isomorphism_valid_throwing().
|
private |
Definition at line 90 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::clear(), vcsn::are_isomorphicer< Aut1, Aut2 >::fill_nouts_(), and vcsn::are_isomorphicer< Aut1, Aut2 >::is_isomorphism_valid_throwing().
state_classes_t vcsn::are_isomorphicer< Aut1, Aut2 >::state_classes_ |
Definition at line 246 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_nonsequential(), vcsn::are_isomorphicer< Aut1, Aut2 >::initialize_next_class_combination_state(), vcsn::are_isomorphicer< Aut1, Aut2 >::next_class_combination(), and vcsn::are_isomorphicer< Aut1, Aut2 >::update_result_isomorphism().
|
private |
Definition at line 97 of file are-isomorphic.hh.
Referenced by vcsn::are_isomorphicer< Aut1, Aut2 >::get_full_response_sequential().