Newer
Older
/*
* RandomAutomatonFactory.cpp
*
* Created on: 27. 3. 2014
* Author: Tomas Pecka
*/
#include "RandomAutomatonFactory.h"
namespace automaton {
namespace generate {
automaton::NFA < char, unsigned > RandomAutomatonFactory::generateNFA( size_t statesCount, size_t alphabetSize, bool randomizedAlphabet, double density ) {
throw exception::CommonException("Too big alphabet.");
ext::deque < char > alphabet;
alphabet.push_back ( i + 'a' );
shuffle(alphabet.begin(), alphabet.end(), ext::random_devices::semirandom);
alphabet.resize ( alphabetSize );
return RandomAutomatonFactory::LeslieConnectedNFA( statesCount, alphabet, density );
}
unsigned RandomAutomatonFactory::ithAccessibleState ( const ext::deque < bool > & VStates, size_t i ) {
i ++;
for( size_t j = 0; j < VStates.size ( ); j++ ) {
if( VStates[ j ] == true )
i --;
throw std::logic_error ( "Not enough states in deque of visited states" );
}
unsigned RandomAutomatonFactory::ithInaccessibleState ( const ext::deque < bool > & VStates, size_t i ) {
i ++;
for( size_t j = 0; j < VStates.size ( ); j++ ) {
if( VStates[ j ] == false )
i --;
throw std::logic_error ( "Not enough states in deque of visited states" );
auto GenerateNFA = registration::AbstractRegister < RandomAutomatonFactory, automaton::NFA < char, unsigned >, size_t, size_t, bool, double > ( RandomAutomatonFactory::generateNFA, abstraction::AlgorithmCategories::AlgorithmCategory::DEFAULT, "statesCount", "alphabetSize", "randomizedAlphabet", "density" );
} /* namespace generate */
} /* namespace automaton */