How to determine the number of states of finite automata according to any language? - finite-automata

I have a burning question about finite state machines, that how we can know that this language needs 2 states or 3 states? I mean is there any formula for that?
Although I believe, we would always work to minimize the number of states but still How can we determine the number of states to be created according to any language or string (without actually constructing the DFA)?

You are in effect asking about DFA minimization. It is a well-studied problem for which a number of algorithms have been developed. The Wikipedia article on it is a good starting point.
The theoretical result which governs the number of states is the Myhill-Nerode theorem, but this theorem doesn't give any quick formula. You have to determine the number of equivalence classes in an equivalence relation defined in terms of the language. Hopcroft's algorithm for DFA minimization is essentially an algorithm for determining the equivalence classes in the Myhill-Nerode equivalence relation. I suspect that any attempt to use Myhill-Nerode more directly is going to lead to something similar to Hopcroft's algorithm, though I am not an expert in the field.

Aho-corasick multiple pattern matching algorithm is a finite state machine with only 1 state.

Related

Need an example of a DFA with large number of states?

I am trying to parallelize the regular expression matching process. I have implemented the algorithm and all, what I need now is a real world problem (deterministic finite automaton) with a large number of states, so I could do some benchmarking of my algorithm. By that, I mean a problem that is known for taking plenty of memory and processing time.
Please feel free to share any example of DFA with more than 100 states.

DFA which recognises the language {ϵ,a,b}

How could I show that there exist infinitely many DFA's each of which recognises the language {ϵ,a,b}.
That depends on how you are counting DFAs. Clearly there is one DFA for the language, and you can always add an unreachable state to the automaton. Ordinarily, though, such trivial differences are discounted, and with a finite language, there are only a finite number of different DFAs. With an infinite language there would be cycles in the transition graph which can be expanded again and again, which makes for a more significant difference. Another way to put it, you cannot show that there exist an infinite number of different DFAs for the given finite language.

Converting decision problems to optimization problems? (evolutionary algorithms)

Decision problems are not suited for use in evolutionary algorithms since a simple right/wrong fitness measure cannot be optimized/evolved. So, what are some methods/techniques for converting decision problems to optimization problems?
For instance, I'm currently working on a problem where the fitness of an individual depends very heavily on the output it produces. Depending on the ordering of genes, an individual either produces no output or perfect output - no "in between" (and therefore, no hills to climb). One small change in an individual's gene ordering can have a drastic effect on the fitness of an individual, so using an evolutionary algorithm essentially amounts to a random search.
Some literature references would be nice if you know of any.
Application to multiple inputs and examination of percentage of correct answers.
True, a right/wrong fitness measure cannot evolve towards more rightness, but an algorithm can nonetheless apply a mutable function to whatever input it takes to produce a decision which will be right or wrong. So, you keep mutating the algorithm, and for each mutated version of the algorithm you apply it to, say, 100 different inputs, and you check how many of them it got right. Then, you select those algorithms that gave more correct answers than others. Who knows, eventually you might see one which gets them all right.
There are no literature references, I just came up with it.
Well i think you must work on your fitness function.
When you say that some Individuals are more close to a perfect solution can you identify this solutions based on their genetic structure?
If you can do that a program could do that too and so you shouldn't rate the individual based on the output but on its structure.

Advantages/Disadvantages of NFA over DFA and vice versa

What are the relative pro's and con's of both DFA's and NFA's when compared to each other?
I know that DFA's are easier to implement than NFA's and that NFA's are slower to arrive at the accept state than DFA's but are there any other explicit, well known advantages/disadvantages?
NFAs and DFAs accept the same set of languages - the regular languages.
A direct implementation of an NFA (which is not a DFA, since DFA is a subset of NFA) usually involves allowing backtracking whereas a direct implementation of a DFA requires only as many steps as the input length, so in that sense, DFAs "arrive at the answer" faster than equivalent NFAs (which are not DFAs).
When trying to find a FA corresponding to a given language or RE (e.g., by an algorithm), it is usually easier to arrive first at the NFA (since the rules are less strict). This is especially true when attempting to demonstrate the existence of a FA, since the existence of an NFA is as good as the existence of a DFA. If a DFA is needed, algorithms exist for (a) converting the NFA to an equivalent DFA and (b) minimizing the DFA.
Making gross generalizations, DFAs are faster but more complex (in terms of number of states and transitions) whereas NFAs are slower but more simple (in the same terms).
The advantage of NFA's over DFA's is the property, to always "choose the right path". Since you cannot say in an algorithm to "choose the right path", usually a conversion from NFA to DFA works, creating DFA states that symbolize multiple NFA states. Thus, when your NFA is in State A and has the choice to go to A,B or C then the next state in your DFA would be {A,B,C}.
This explains the advantages and the disadvantages:
DFA's can be implemented easier since their next state is determined by a function.
NFA's allow a user to easier express what they want, because the NFA can choose between many path's.
One definite advantage of NFA's over DFA's is that, you can build a FA representing the language that is a union, intersection, concetanation etc. of two (or more) languages easily by using NFA's. That is to say, if you have slightly simple FA's doing parts of the job, you can combine them easily using NFA's. While using a DFA, you need to build a new automata doing all the job by itself.
see, it is easier to implement.
but there's the time issue as you mentioned.

rule based fuzzy control system and function approximation

I am trying to implement a function approximator (aggregation) using a rule-based fuzzy control system. So as to simplify my implementation (and have better understanding) I am trying to approximate y=x^2 (the simplest non-linear function). As far as i understand i have to map my input (e.g. uniform samples over [-1,1]) to fuzzy sets (fuzzyfication) and then use a defuzzyfication method to take crisp values. Is there any simple explanation of this procedure because fuzzy control system literature is a bit mess.
This is sort of a broad question, but I'll give it a go since it has sat unanswered for so long.
First, I believe you need to refine your objective (at least as it stated here). I would hesitate to use the term "function approximation" in this context. If I follow your question correctly, the objective is map a non-linear function into another domain via fuzzy methods.
To do so, you first need to define your fuzzy set membership functions. (This link is a good example of the process.) Without additional information, the I recommend the triangular function due to its ease in implementation. The number of fuzzy sets, their placement and width (or support), and degree of overlap is application specific. You've indicated that your input domain is [-1,1], so you might find that three fuzzy sets does the trick, i.e Negative, Zero, and Positive.
From there, you need to craft a set of rules, i.e. if x is Negative then...
With rules in place, you can then define the defuzzification process. In short, this step weights the activation of each rule according to the needs of the application.
I don't believe I can contribute more fully until the output is better defined. You state "use a defuzzyfication method to take crisp values." - what does this set of crisp values mean? What is the range? Etc. Furthermore, you'll get more a response if you can identify the areas in which you are stuck (i.e. more specific questions).