|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--SimFinder
The SimFinder is the GA that we use to search for similarities in
MusicGraph
s. This is where all the loose ends come
together.
Field Summary | |
double |
crossoverrate
|
java.util.Vector |
forbiddenSubgraphs
A Vector of Subgraphs which we do not want to find again. |
double |
freshBloodChance
The probability that a mutation of a similarity statement will result in a total replacement of one of its subgraphs. |
double |
groupBaseGamma
A parameter for the grouping viewpoint. |
int |
initSubSize
Initial size of random subgraphs. |
int |
maxSubSize
The upper limit on the size of subgraphs inside similarity statements; if 0, there is no upper limit. |
double |
mutationrate
|
MotherGraph |
piece
The MotherGraph being search for similarities. |
int |
popsize
The population size. |
int |
reportFrequency
How many generations should pass in the GA before a new statusreport is printed on screen. |
SimilarityMeasure |
simMeasure
The similarity measure used to evaluate similarity statements in the population. |
Constructor Summary | |
SimFinder(int psize,
java.lang.String fname,
int isubsize,
double co,
double mut,
int repFreq,
SimilarityMeasure sm,
Subgraph occ,
int mxsubsize,
double freshBlood)
Constructs a Simfinder running on a MIDI file. |
|
SimFinder(MotherGraph mother,
int psize,
int isubsize,
double co,
double mut,
int repFreq,
SimilarityMeasure sm,
Subgraph occ,
int mxsubsize,
double freshBlood,
double groupBase)
Constructs a Simfinder from any MotherGraph . |
Method Summary | |
void |
appendVertexUseStatsToFile(java.lang.String filename)
|
void |
checkPopulation(java.lang.String label)
For debugging. |
StatusInfo |
collectStatusInfo(int gen)
Returns a StatusInfo object describing this generation. |
int |
countIdSub(java.util.Vector pop)
Returns the number of SimilarityStatement s which have
identical Subgraph s. |
void |
countUsageInfo()
Sets the useCounter in each vertice. |
void |
crossover(java.util.Vector next)
Adds a new SimilarityStatement s to the population of
the next generation. |
void |
deprecatedStatusInfo(int gen)
|
int |
edgeCoverage()
Computes how many edges in the mother piece that are included in a SimStmt in the population |
SimilarityStatement |
findBest()
Returns the individual in the population with the best fitness. |
static void |
main(java.lang.String[] args)
Creates a SimFinder from a MIDI file, with some hardcoded parameters. |
void |
mutatePercentageOfPop(double percent)
Mutates a percentage of the population. |
void |
mutation(java.util.Vector next)
Picks a random individual in the population. |
int |
numberPickedByCrossover()
Returns the number of individuals in the next generation to be found by crossover. |
int |
numberPickedByMutation()
Returns the number of individuals in the next generation to be found by mutation. |
int |
numberPickedByTournament()
Returns the number of individuals in the next generation to be found by tournament selection. |
boolean |
occurrenceSearch()
Returns true if it is doing an occurrence search. |
void |
printMemStatus()
Prints the memory status of the computer. |
void |
run(int generations,
java.lang.String statusFilename)
Runs the Simfinder for a number of generations. |
boolean |
seqPop()
Returns true, if the population is sequential. |
void |
showBest()
Opens two GraphWindow 's showing the two subgraphs of
the best SimilarityStatement . |
void |
showPopulation()
Opens a GraphList 's showing the subgraphs of
the population. |
void |
sleep(long millisecs)
Lets the thread sleep for millisecs milliseconds. |
void |
testPopulationIntegrity()
for debugging |
SimilarityStatement |
tournament()
Returns a clone of the most fit of two rendomly chosen SimilarityStatement . |
int |
vertexCoverage()
Computes how many vertices in the mother piece that are included in a SimStmt in the population |
void |
writeHistoryToFile(java.lang.String statusFilename)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public int popsize
public MotherGraph piece
public int initSubSize
public int maxSubSize
public double crossoverrate
public double mutationrate
public double freshBloodChance
public int reportFrequency
public SimilarityMeasure simMeasure
public java.util.Vector forbiddenSubgraphs
public double groupBaseGamma
Constructor Detail |
public SimFinder(int psize, java.lang.String fname, int isubsize, double co, double mut, int repFreq, SimilarityMeasure sm, Subgraph occ, int mxsubsize, double freshBlood) throws java.lang.Exception
MotherGraph
is constructed from a
MIDI file name.
public SimFinder(MotherGraph mother, int psize, int isubsize, double co, double mut, int repFreq, SimilarityMeasure sm, Subgraph occ, int mxsubsize, double freshBlood, double groupBase) throws java.lang.Exception
MotherGraph
. Parameters are set for the GA.
mother
- the MotherGraph
.psize
- the GA-population size.isubsize
- the initial size of the subgraphs in the population.co
- the GA-crossover rate.mut
- the GA-mutation rate.repFreq
- the report frequency. Info is printed for every frequency generarions.sm
- the SimilarityMeasure
to be used in this SimFinder.occ
- the graph to be found more occurrences of.freshBlood
- the GA-freshblood chance.groupBase
- the grouping structure value.
java.lang.Exception
- throws an exception if it is not able to make an
initialisation of new SimStmts with the specified isubsize.Method Detail |
public boolean occurrenceSearch()
public static void main(java.lang.String[] args)
public boolean seqPop()
public int numberPickedByCrossover()
public int numberPickedByTournament()
public int numberPickedByMutation()
public void run(int generations, java.lang.String statusFilename) throws java.lang.Exception
generations
- the number of generationsstatusFilename
- the output file
java.lang.Exception
- if the SimFinder is not properly initialised (popSize is 0)public void printMemStatus()
public void writeHistoryToFile(java.lang.String statusFilename)
public SimilarityStatement findBest()
public void showBest()
GraphWindow
's showing the two subgraphs of
the best SimilarityStatement
.
public void showPopulation()
GraphList
's showing the subgraphs of
the population.
public StatusInfo collectStatusInfo(int gen)
StatusInfo
object describing this generation.
public void deprecatedStatusInfo(int gen)
public int countIdSub(java.util.Vector pop)
SimilarityStatement
s which have
identical Subgraph
s.
public void crossover(java.util.Vector next)
SimilarityStatement
s to the population of
the next generation. Crossover is done by randomly selecting
two SimilarityStatement
s in the population and then
selecting randomly one Subgraph
from each SimilarityStatement
. The selected Subgraph
s are put
into a new SimilarityStatement
which is added to the
population in the next generation.
public void mutatePercentageOfPop(double percent)
public void mutation(java.util.Vector next)
public SimilarityStatement tournament()
SimilarityStatement
.
public int vertexCoverage()
public int edgeCoverage()
public void countUsageInfo()
public void appendVertexUseStatsToFile(java.lang.String filename)
public void testPopulationIntegrity()
public void sleep(long millisecs)
public void checkPopulation(java.lang.String label)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |