Class SimSegmenter

java.lang.Object
  |
  +--SimSegmenter

public class SimSegmenter
extends java.lang.Object

Class SimSegmenter embodies the segmentation algorithm. Its constructor accepts a host of parameters that control both how the SimSegmenter itself runs but also how it should use the SimFinder.


Field Summary
 double crossover
          Parameter for the SimFinder.
 java.lang.String file
          Name of the midi or MuseData file that 'mother' is constructed from.
 double freshBloodChance
          Parameter for the SimFinder.
 int generationsAfterLimitReached
          How many generations a SimSegmenter should keep searching for similarities using a given SimilarityMeasure even though it finds an acceptable similarity.
 int gensPerLimitCheck
          How many generations the SimSegmenter should run the SimFinder between checks for SimilarityStatements that have come under the limit, i.e. for acceptable matches.
 double groupBase
          Parameter for the SimFinder (groupBaseGamma).
 int initSize
          Parameter for the SimFinder (called initSubSize in the SimFinder).
 double limit
          The limit value that SimilarityStatements must come below to be acceptable.
 int maxSize
          Parameter for the SimFinder (maxSubsize).
 SimilarityMeasure[] measures
          The set of similarity measures ranked from specific to general.
 MotherGraph mother
          The MotherGraph being segmented by this SimSegmenter.
 double mutation
          Parameter for the SimFinder.
 java.util.Vector nonterm
          A Vector of Nonterminals already created.
 int nonTerminalNumber
          The current nonterminal number.
 int occGens
          How many generations a SimSegmenter should search for occurrences using a given SimilarityMeasure before giving up.
 int popSize
          Parameter for the SimFinder (populationSize)
 java.util.Vector prodRules
          A Vector of all GraphProductionRules already created.
 int repFreq
          Parameter for the SimFinder (reportFrequency)
 SimFinder sf
          The current SimFinder used by this SimSegmenter.
 int simGens
          How many generations a SimSegmenter should search for similarities using a given SimilarityMeasure before giving up.
 SimilarityMeasure theMeasure
          The current similarity measure used for searching.
 
Constructor Summary
SimSegmenter(java.lang.String filename, boolean interpartEdges, boolean combineTies, boolean combineRests, SimilarityMeasure[] meas, double cross, double mut, int initsz, int popsz, int repfq, java.lang.String outfile, int simgen, int occgen, double lim, int maxsiz, double freshblood, int gensAfterLimitReached, int gensLimitCheck, double gamma)
           
 
Method Summary
static void main(java.lang.String[] args)
          Starts the SimSegmenter: Usage: java SimSegmenter
 void run()
          Runs the Simsegmenting algorithm.
 void show()
          Shows the population in the last generation.
 void showAllProductionRules(java.util.Vector pr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sf

public SimFinder sf
The current SimFinder used by this SimSegmenter.


mother

public MotherGraph mother
The MotherGraph being segmented by this SimSegmenter.


crossover

public double crossover
Parameter for the SimFinder.


mutation

public double mutation
Parameter for the SimFinder.


initSize

public int initSize
Parameter for the SimFinder (called initSubSize in the SimFinder).


popSize

public int popSize
Parameter for the SimFinder (populationSize)


repFreq

public int repFreq
Parameter for the SimFinder (reportFrequency)


maxSize

public int maxSize
Parameter for the SimFinder (maxSubsize).


freshBloodChance

public double freshBloodChance
Parameter for the SimFinder.


groupBase

public double groupBase
Parameter for the SimFinder (groupBaseGamma).


file

public java.lang.String file
Name of the midi or MuseData file that 'mother' is constructed from.


simGens

public int simGens
How many generations a SimSegmenter should search for similarities using a given SimilarityMeasure before giving up.


occGens

public int occGens
How many generations a SimSegmenter should search for occurrences using a given SimilarityMeasure before giving up.


generationsAfterLimitReached

public int generationsAfterLimitReached
How many generations a SimSegmenter should keep searching for similarities using a given SimilarityMeasure even though it finds an acceptable similarity. If -1, runs through all occGens.


gensPerLimitCheck

public int gensPerLimitCheck
How many generations the SimSegmenter should run the SimFinder between checks for SimilarityStatements that have come under the limit, i.e. for acceptable matches.


limit

public double limit
The limit value that SimilarityStatements must come below to be acceptable. This varies between similarity measures.


theMeasure

public SimilarityMeasure theMeasure
The current similarity measure used for searching.


measures

public SimilarityMeasure[] measures
The set of similarity measures ranked from specific to general.


nonTerminalNumber

public int nonTerminalNumber
The current nonterminal number.


nonterm

public java.util.Vector nonterm
A Vector of Nonterminals already created.


prodRules

public java.util.Vector prodRules
A Vector of all GraphProductionRules already created.

Constructor Detail

SimSegmenter

public SimSegmenter(java.lang.String filename,
                    boolean interpartEdges,
                    boolean combineTies,
                    boolean combineRests,
                    SimilarityMeasure[] meas,
                    double cross,
                    double mut,
                    int initsz,
                    int popsz,
                    int repfq,
                    java.lang.String outfile,
                    int simgen,
                    int occgen,
                    double lim,
                    int maxsiz,
                    double freshblood,
                    int gensAfterLimitReached,
                    int gensLimitCheck,
                    double gamma)
             throws java.lang.Exception
Parameters:
filename - The input file.
interpartEdges - Whether the graph should be partwise (interpartEdges = false) or not (interpartEdges = true).
combineTies - Make only one note (vertice) in stead of two tied.
combineRests - Make one (longer) rest (vertice) in stead of two (shorter).
meas - the array of SimilarityMeasures. The order of the measures determines the order in which the search takes place.
cross - the crossover parameter used in the GA.
initsz - the initial size for the subgraphs used in the GA.
popsz - the population size used in the GA.
repfq - report frequency used in the GA.
outfile - the output file used in the GA.
simgen - the number of generations used in the GA to find best matching graphs.
occgen - the number of generations used to find an occurrence of an already found Subgraph.
lim - the threshold. SimilarityStatements with a fitness below this limit are accepted (ant their subgraphs substituted with a compound).
maxsiz - it is possoble to specify a maximal size for the subgraphs used in the GA.
freshblood - used in the GA.
gensAfterLimitReached - runs this number of generations even though the mest found aslready is below the limit (threshold lim) specified.
gensLimitCheck - run this number of generations before checking if the limit is reached.
gamma - the grouping structire value
Throws:
java.lang.Exception - if the SimFinder is not able to be constructed.
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Starts the SimSegmenter: Usage: java SimSegmenter

java.lang.Exception

run

public void run()
Runs the Simsegmenting algorithm.


show

public void show()
Shows the population in the last generation.


showAllProductionRules

public void showAllProductionRules(java.util.Vector pr)