cfl_determin.h

Go to the documentation of this file.
00001 /** @file cfl_determin.h powersetset construction */
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_DETERMIN_H
00024 
00025 #include "cfl_definitions.h"
00026 #include "cfl_agenerator.h"
00027 
00028 namespace faudes {
00029 
00030 
00031 /**
00032  * Make initial states unique.
00033  * If the argument generator has precisely one initial state, this function does nothing. 
00034  * Else, this function introduces a new and unique initial state and relinks transitions
00035  * accordinly. If the argument generator used to have more than one initial state, this operation
00036  * may render the output nondeterministic. If the argument generator used to have no
00037  * initial state, the output generator will generate the empty string language as opposed to
00038  * the empty language. Otherwise, generated and marked languages are preserved. 
00039  *
00040  * Note: call this function followed by determine to convert the generator to a
00041  * deterministic generator with exactly one initial state.
00042  *
00043  *
00044  * @param rGen
00045  *   Reference to generator
00046  *
00047  * @ingroup GeneratorFunctions
00048  */
00049 void UniqueInit(Generator& rGen);
00050 
00051 /**
00052  * Make initial states unique.
00053  *
00054  * Convenience wrapper for UniqueInit(Generator&).
00055  *
00056  *
00057  * @param rGen
00058  *   Reference to generator
00059  * @param rResGen
00060  *   Reference to resulting generator
00061  *
00062  * @ingroup GeneratorFunctions
00063  */
00064 void UniqueInit(const Generator& rGen, Generator& rResGen);
00065 
00066 
00067 /**
00068  * Make generator deterministic.
00069  * Constructs a deterministic generator while preserving the generated and marked languages.
00070  * The implementation is based on the so called multiway merge variant of subset construction, 
00071  * in which the new state set becomes a subset of the power set og the given state set. It is of
00072  * exponential complexity. For details on the multiway merge algorithm see
00073  * "Ted Leslie, Efficient Approaches to Subset Construction, 
00074  *  Computer Science, University of Waterloo, 1995".
00075  * See also 
00076  * Deterministic(const Generator&,std::map<Idx,StateSet>&,Generator& rResGen) and
00077  * Deterministic(const Generator&,std::vector<StateSet>&,std::vector<Idx>&,Generator& rResGen).
00078  *
00079  * Technical detail: if the input has no initial state, then so has the output. In this
00080  * aspect this function does not match the test IsDeterministic(). See also UniqueInit().
00081  * 
00082  * @param rGen
00083  *   Reference to generator
00084  * @param rResGen
00085  *   Reference to resulting deterministic generator
00086  *
00087  * <h4>Example:</h4>
00088  * <table>
00089  * <tr> <td> Generator G </td> <td> Deterministic(G,Result) </td> </tr>
00090  * <tr>
00091  * <td> @image html tmp_deterministic_nondet.png </td>
00092  * <td> @image html tmp_deterministic_det.png </td>
00093  * </tr>
00094  * </table> 
00095  *
00096  * @ingroup GeneratorFunctions
00097  */
00098 void Deterministic(const Generator& rGen, Generator& rResGen);
00099 
00100 /**
00101  * Make generator deterministic.
00102  *
00103  * See also Deterministic(const Generator&, Generator&).
00104  * This version maintains event attributes provided they can be castes
00105  * to the result type.
00106  *
00107  * @param rGen
00108  *   Reference to generator
00109  * @param rResGen
00110  *   Reference to resulting deterministic generator
00111  *
00112  * @ingroup GeneratorFunctions
00113  */
00114 void aDeterministic(const Generator& rGen, Generator& rResGen);
00115 
00116 /**
00117  * Make generator deterministic.
00118  *
00119  * Constructs a deterministic generator while preserving the generated and marked languages.
00120  * See Deterministic(const Generator&,Generator& rResGen) for the intended
00121  * api. This version provides as a second parameter the resulting map from new states to
00122  * their respective original state set. It is used as a so called "entry state map" 
00123  * for deterministic projected generators.
00124  *
00125  * @param rGen
00126  *   Reference to generator
00127  * @param rEntryStatesMap
00128  *   Entry state map
00129  * @param rResGen
00130  *   Reference to resulting deterministic generator
00131  */
00132 void Deterministic(const Generator& rGen, std::map<Idx,StateSet>& rEntryStatesMap,
00133        Generator& rResGen);
00134 
00135 /**
00136  * Make generator deterministic. 
00137  *
00138  * Constructs a deterministic generator while preserving the generated and marked languages.
00139  * See Deterministic(const Generator&,Generator& rResGen) for the intended api. 
00140  * This version provides as second and third parameters the correspondence 
00141  * between new states and the original state sets.
00142  * in vectors
00143  *
00144  * @param rGen
00145  *   Reference to generator
00146  * @param rPowerStates
00147  *   Vector that holds the power states
00148  * @param rDetStates 
00149  *   Vector that holds the corresponding deterministic states
00150  * @param rResGen
00151  *   Reference to resulting deterministic generator
00152  */
00153 void Deterministic(const Generator& rGen, std::vector<StateSet>& rPowerStates, 
00154        std::vector<Idx>& rDetStates, Generator& rResGen);
00155 
00156 
00157 
00158 } // namespace faudes
00159 
00160 #define FAUDES_DETERMIN_H
00161 #endif 
00162 

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen