| |
libFAUDES
Sections
Index
|
parallel.hGo to the documentation of this file.00001 /** @file parallel.h parallel composition */ 00002 00003 /* FAU Discrete Event Systems Library (libfaudes) 00004 00005 Copyright (C) 2006 Bernd Opitz 00006 Exclusive copyright is granted to Klaus Schmidt 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Lesser General Public 00010 License as published by the Free Software Foundation; either 00011 version 2.1 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library; if not, write to the Free Software 00020 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 00021 00022 00023 #ifndef FAUDES_PARALLEL_H 00024 00025 #include "agenerator.h" 00026 #include <stack> 00027 #include <map> 00028 #include <set> 00029 00030 namespace faudes { 00031 00032 00033 /** 00034 * Parallel composition. 00035 * 00036 * Constructs the parallel composition of two generators, where shared events 00037 * are synchronised while non-shared events are executed independantly. 00038 * The resulting generators alphabet is the union of the argument alphabets. 00039 * In this implementation, only accessible states are generated. 00040 * On deterministic input this functions constructs a deterministic output. 00041 * See also Parallel(const vGenerator&,std::map< std::pair<Idx,Idx>, Idx>&,const vGenerator&, vGenerator&). 00042 * 00043 * @param rGen1 00044 * First generator 00045 * @param rGen2 00046 * Second generator 00047 * @param rResGen 00048 * Reference to resulting parallel composition generator 00049 * 00050 * <h4>Example:</h4> 00051 * <table border=0> <tr> <td> <table> 00052 * <tr> <td> Generator G1 </td> <td> Generator G2 </td> </tr> 00053 * <tr> 00054 * <td> @image html tmp_parallel_g1.png </td> 00055 * <td> @image html tmp_parallel_g2.png </td> 00056 * </tr> 00057 * </table> </td> </tr> <tr> <td> <table width=100%> 00058 * <tr> <td> G1 || G2 </td> </tr> 00059 * <tr> <td> @image html tmp_parallel_g1g2.png </td> </tr> 00060 * </table> </td> </tr> </table> 00061 * 00062 * @ingroup GeneratorFunctions 00063 * 00064 */ 00065 void Parallel(const vGenerator& rGen1, const vGenerator& rGen2, vGenerator& rResGen); 00066 00067 00068 /** 00069 * Parallel composition. 00070 * 00071 * See also Parallel(const vGenerator&, const vGenerator&, vGenerator&). 00072 * This version tries to be transparent on event attributes: if 00073 * argument attributes match and if the result can take the respective 00074 * attributes, then they are copied; it is considered an error if 00075 * argument attributes do not match. 00076 * 00077 * @param rGen1 00078 * First generator 00079 * @param rGen2 00080 * Second generator 00081 * @param rResGen 00082 * Reference to resulting composition generator 00083 * 00084 * @ingroup GeneratorFunctions 00085 */ 00086 void aParallel(const vGenerator& rGen1, const vGenerator& rGen2, vGenerator& rResGen); 00087 00088 /** 00089 * Parallel composition. 00090 * 00091 * See Parallel(const vGenerator&, const vGenerator&, vGenerator&). 00092 * This version fills given a reverse composition map to map pairs of old states 00093 * to new states. 00094 * 00095 * @param rGen1 00096 * First generator 00097 * @param rGen2 00098 * Second generator 00099 * @param rReverseCompositionMap 00100 * Reverse composition map (map< pair<Idx,Idx>, Idx>) 00101 * @param rResGen 00102 * Reference to resulting parallel composition generator 00103 */ 00104 void Parallel( 00105 const vGenerator& rGen1, const vGenerator& rGen2, 00106 std::map< std::pair<Idx,Idx>, Idx>& rReverseCompositionMap, 00107 vGenerator& rResGen); 00108 00109 00110 /** 00111 * Product composition. 00112 * 00113 * The product composition executes shared events only. The resulting 00114 * generators alphabet is the interscetion of the argument alphabets. 00115 * In this implementation, only accessible states are generated. 00116 * Assumes deterministic input generators, result is deterministic. 00117 * 00118 * @param rGen1 00119 * First generator 00120 * @param rGen2 00121 * Second generator 00122 * @param rResGen 00123 * Reference to resulting product composition generator 00124 * 00125 * @ingroup GeneratorFunctions 00126 */ 00127 void Product(const vGenerator& rGen1, const vGenerator& rGen2, vGenerator& rResGen); 00128 00129 00130 /** 00131 * Product composition. 00132 * 00133 * See Product(const vGenerator&, const vGenerator&, vGenerator&). 00134 * This version fills given reverse composition map to map pairs of old states 00135 * to new states. 00136 * 00137 * @param rGen1 00138 * First generator 00139 * @param rGen2 00140 * Second generator 00141 * @param rReverseCompositionMap 00142 * Reverse composition map (map< pair<Idx,Idx>, Idx>) 00143 * @param rResGen 00144 * Reference to resulting product composition generator 00145 */ 00146 void Product( 00147 const vGenerator& rGen1, const vGenerator& rGen2, 00148 std::map< std::pair<Idx,Idx>, Idx>& rReverseCompositionMap, 00149 vGenerator& rResGen); 00150 00151 00152 /** 00153 * Product composition. 00154 * 00155 * See also Product(const vGenerator&, const vGenerator&, vGenerator&). 00156 * This version tries to be transparent on event attributes: if 00157 * argument attributes match and if the result can take the respective 00158 * attributes, then they are copied; it is considered an error if 00159 * argument attributes do not match. 00160 * 00161 * @param rGen1 00162 * First generator 00163 * @param rGen2 00164 * Second generator 00165 * @param rResGen 00166 * Reference to resulting product composition generator 00167 * 00168 * @ingroup GeneratorFunctions 00169 */ 00170 void aProduct(const vGenerator& rGen1, const vGenerator& rGen2, vGenerator& rResGen); 00171 00172 00173 /** 00174 * Helper: uses reverse composition map to track state names 00175 * in a paralell composition. Purely cosmetic. 00176 * 00177 * @param rGen1 00178 * First generator 00179 * @param rGen2 00180 * Second generator 00181 * @param rReverseCompositionMap 00182 * Reverse composition map (map< pair<Idx,Idx>, Idx>) 00183 * @param rGen12 00184 * Reference to resulting parallel composition generator 00185 */ 00186 void SetComposedStateNames( 00187 const vGenerator& rGen1, const vGenerator& rGen2, 00188 const std::map< std::pair<Idx,Idx>, Idx>& rReverseCompositionMap, 00189 vGenerator& rGen12); 00190 00191 /** 00192 * Helper: extract composition map from reverse composition map. 00193 * The reverse composition map is an optional return value of functions 00194 * that operate on the product state space of two component generators, e.g. Parallel. 00195 * It maps pairs of component state indices to the correponding index in the product set. 00196 * Occasionally, one requires a map from the product space to to one of the component indicees. 00197 * This function extracts the latter from the reverse composition map. There are two versions, 00198 * one for each component. 00199 * 00200 * @param rReverseCompositionMap 00201 * provided map from pairs of component states to states in the product space 00202 * @param rCompositionMap 00203 * resulting map from the product space to states from the first compoent 00204 * 00205 */ 00206 void CompositionMap1( 00207 const std::map< std::pair<Idx,Idx>, Idx>& rReverseCompositionMap, 00208 std::map<Idx,Idx>& rCompositionMap); 00209 00210 00211 /** 00212 * Helper: extract composition map from reverse composition map. 00213 * See also CompositionMap1. 00214 * 00215 * @param rReverseCompositionMap 00216 * provided map from pairs of component states to states in the product space 00217 * @param rCompositionMap 00218 * resulting map from the product space to states from the second component 00219 * 00220 */ 00221 void CompositionMap2( 00222 const std::map< std::pair<Idx,Idx>, Idx>& rReverseCompositionMap, 00223 std::map<Idx,Idx>& rCompositionMap); 00224 00225 00226 00227 /** 00228 * Parallel composition with relaxed acceptance condition. 00229 * 00230 * This version of the parallel composition relaxes the synchronisation of the acceptance 00231 * condition (marking). It requires that the omega extension of the generated language 00232 * has infinitely many prefixes that comply to the marked languages of G1 and G2, each. 00233 * It does however not require the synchronous acceptance. 00234 * 00235 * @param rGen1 00236 * First generator 00237 * @param rGen2 00238 * Second generator 00239 * @param rResGen 00240 * Reference to resulting parallel composition generator 00241 * 00242 * 00243 * @ingroup GeneratorFunctions 00244 * 00245 */ 00246 void OmegaParallel(const vGenerator& rGen1, const vGenerator& rGen2, vGenerator& rResGen); 00247 00248 00249 /** 00250 * Parallel composition with relaxed acceptance condition. 00251 * 00252 * See also OmegaParallel(const vGenerator&, const vGenerator&, vGenerator&). 00253 * This version tries to be transparent on event attributes: if 00254 * argument attributes match and if the result can take the respective 00255 * attributes, then they are copied; it is considered an error if 00256 * argument attributes do not match. 00257 * 00258 * @param rGen1 00259 * First generator 00260 * @param rGen2 00261 * Second generator 00262 * @param rResGen 00263 * Reference to resulting composition generator 00264 * 00265 * @ingroup GeneratorFunctions 00266 */ 00267 void aOmegaParallel(const vGenerator& rGen1, const vGenerator& rGen2, vGenerator& rResGen); 00268 00269 } // namespace faudes 00270 00271 #define FAUDES_PARALLEL_H 00272 #endif 00273 |
libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6