12/09/07

Java Implementation of FSM / FSA State Minimization

Finite State Machines (FSM) or Finite State Automata (FSA) are commonly used in computer science.  In order to prevent a state explosion it can be useful to minimize the  state machine. John E. Hopcroft has presented an n log n algorithm for minimizing states in a finite automaton.  Since I could not find a Java implementation I hereby present my "naive" implementation of one night's work. 

The implementation follows the guide of "D. Gries - Describing an Algorithm by Hopecroft". The PDF version of this paper can be obtained from http://springerlink.com.

This is just a straight forward implementation of the pseudo code provided in Gries'  paper. This code has not been tested very thoroughly and performance could still be improved. Please note that this is provided as is and with no warranties at all. I would appreciate any feedback. Feel free to use the code.

Download

FMS.jar

State Machine - Java 5 compatible .jar file. Also contains the source.

15.5 K

HopcroftMinimizer.jar

Minimizer - Java 5 compatible .jar file. Also contains the source.

17.3 K

MinimizerTest.java

This is a JUnit Test. It can server as an example on how to use the minimizer.

5.0 K