libFAUDES
Sections
Index
|
mtc_redundantcolors.hGo to the documentation of this file.00001 /** @file mtc_redundantcolors.h 00002 00003 Methods for removing redundant colors for the supervisor synthesis from MtcSystems 00004 00005 */ 00006 00007 /* FAU Discrete Event Systems Library (libfaudes) 00008 00009 Copyright (C) 2008 Matthias Singer 00010 Copyright (C) 2006 Bernd Opitz 00011 Exclusive copyright is granted to Klaus Schmidt 00012 00013 This library is free software; you can redistribute it and/or 00014 modify it under the terms of the GNU Lesser General Public 00015 License as published by the Free Software Foundation; either 00016 version 2.1 of the License, or (at your option) any later version. 00017 00018 This library is distributed in the hope that it will be useful, 00019 but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 Lesser General Public License for more details. 00022 00023 You should have received a copy of the GNU Lesser General Public 00024 License along with this library; if not, write to the Free Software 00025 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 00026 00027 00028 #ifndef FAUDES_MTCREDUNDANTCOLORS_H 00029 #define FAUDES_MTCREDUNDANTCOLORS_H 00030 00031 #include "corefaudes.h" 00032 #include "mtc_observercomputation.h" 00033 #include <stack> 00034 #include <list> 00035 00036 namespace faudes { 00037 00038 /** 00039 * Search for strongly connected components (SCC)*** 00040 * This function partitions the stateset of a generator into equivalence classes 00041 * such that states x1 and x2 are equivalent iff there is a path from x1 00042 * to x2 AND a path from x2 to x1. 00043 * This function implements the algorithm based on a depth first search 00044 * presented in: 00045 * -Aho, Hopcroft, Ullman: The Design and Analysis of Computer Algorithms- 00046 * 00047 * Most of the comments in this function have been literally taken from 00048 * this book! 00049 * 00050 * @param state 00051 * State, from which the current recursion is started. 00052 * @param rCount 00053 * denotes the current depth of the recursion. 00054 * @param rGen 00055 * Generator under investigation 00056 * @param rNewStates 00057 * Set of states that up to now were not found by the depth first search 00058 * @param rSTACK 00059 * stack of state indices 00060 * @param rStackStates 00061 * set of states whose indices are on STACK. 00062 * @param rDFN 00063 * map assigning to each state its Depth-First Number 00064 * @param rLOWLINK 00065 * map assigning to each state its LOWLINK Number 00066 * @param rSccSet 00067 * result - the set of strongly connected components 00068 * @param rRoots: 00069 * result - the set of states that each are root of some SCC. 00070 */ 00071 void SearchScc( const Idx state, int& rCount, const Generator& rGen, StateSet& rNewStates, 00072 std::stack<Idx>& rSTACK, StateSet& rStackStates, std::map<const Idx, int>& rDFN, 00073 std::map<const Idx, int>& rLOWLINK, std::set<StateSet>& rSccSet, StateSet& rRoots); 00074 00075 /** 00076 * Computes the strongly connected components (SCCs) of an automaton. 00077 * This function is the wrapper function for Trajan's algorithm that is implemented 00078 * in the function SearchSCC. 00079 * 00080 * @param rGen 00081 * investigated generator 00082 * @param rSccSet 00083 * Set of strongly connected components (result). 00084 * @param rRoots 00085 * Set of states that each are root of some SCC (result). 00086 * 00087 * @return 00088 * true if SCCs have been found, false if not. 00089 * 00090 * @ingroup MultitaskingPlugin 00091 * 00092 */ 00093 bool ComputeSCC(const Generator& rGen, std::set<StateSet>& rSccSet, StateSet& rRoots); 00094 00095 /** 00096 * Compute all strongly connected components (SCCs) in a colored marking generator (CMG) that are marked with a given set of colors. 00097 * This function finds all SCCs in a CMG that contain states with all colors in a given color set. 00098 * To find all SCCs, first the function ComputeSCC is called. 00099 * 00100 * @param rGen 00101 * generator under investigation 00102 * @param rColors 00103 * colors that have to be contained in the SCCs 00104 * @param rColoredSCCs 00105 * SCCs marked with all colors in rColors 00106 * 00107 * @ingroup MultitaskingPlugin 00108 */ 00109 void ColoredSCC(MtcSystem& rGen, ColorSet& rColors, std::set<StateSet>& rColoredSCCs); 00110 00111 /** 00112 * Check if a color in a colored marking generator is redundant for the supervisor synthesis. 00113 * This function determines if a color can be removed from a CMG if it is redundant for 00114 * the supervisor synthesis. The algorithm implements the work in 00115 * K. Schmidt and J.E.R. Cury, "Redundant Colors in the Multitasking Supervisory Control for Discrete 00116 * Event Systems", Workshop on Dependable Control of Discrete Event Systems, 2009. 00117 * 00118 * @param rGen 00119 * Reference to generator 00120 * @param redundantColor 00121 * Index of the color to be removed 00122 + @return 00123 * true if the color can be removed, false otherwise 00124 * 00125 * 00126 * @ingroup MultitaskingPlugin 00127 */ 00128 bool CheckRedundantColor(MtcSystem rGen, Idx redundantColor); 00129 00130 00131 /** 00132 * Compute an optimal subset of the colors that should be removed. 00133 * This function tries to find an optimal subset of colors that can be removed from the given 00134 * colored marking generator without affecting supervisor synthesis. Here, optimality is defined 00135 * w.r.t. the smallest number of states of a high-level generator after removing the colors. 00136 * 00137 * @param rGen 00138 * input colored marking generator 00139 * @param rOptimalColors 00140 * optimal color set to be removed 00141 * @param rHighAlph 00142 * hgh-level alphabet for hierarchical abstraction after color removal. Initially, the alphabet should contain 00143 * all events that must be present in the high-level alphabet 00144 * 00145 * 00146 * @ingroup MultitaskingPlugin 00147 */ 00148 void OptimalColorSet(const MtcSystem& rGen, ColorSet& rOptimalColors, EventSet& rHighAlph); 00149 00150 /** 00151 * Recursively find an optimal set of colors to be removed. 00152 * This function recursively enumerates all possible subsets of colors that can be removed without affecting 00153 * supervisor synthesis and remembers the color set that leads to the smallest hierarchical abstraction. 00154 * It is called by the function OptimalColorSet. 00155 * 00156 * @param rGen 00157 * input colored marking generator 00158 * @param rColorVector 00159 * set of colors of the generator (ordered!) 00160 * @param colorNumber 00161 * number of colors currently removed 00162 * @param rOptimalColors 00163 * current optimal set of colors 00164 * @param rOptimalNumberStates 00165 * current optimal number of states 00166 * @param rOptimalNumberColors 00167 * size of the optimal color set 00168 * @param rHighAlph 00169 * initial high-level alphabet 00170 * @param rOptimalHighAlph 00171 * optimal high-level alphabet 00172 * 00173 */ 00174 void rec_OptimalColorSet(const MtcSystem& rGen, const vector<Idx>& rColorVector, Idx colorNumber, ColorSet& rOptimalColors, 00175 Idx& rOptimalNumberStates, Idx& rOptimalNumberColors, const EventSet& rHighAlph, EventSet& rOptimalHighAlph); 00176 } // namespace faudes 00177 00178 #endif |
libFAUDES 2.20d --- 2011.04.26 --- c++ source docu by doxygen