art.cs
Class Classifier

java.lang.Object
  extended byart.ga.Chromosome
      extended byart.cs.Classifier
All Implemented Interfaces:
Author, GaSolution

public class Classifier
extends Chromosome
implements Author

The Classifier consists in a string of fixed length and binary alphabet. The classifier is the basic object of a CS and is divided in two part: action and condition.

From a internal point of view it is implemented as a chromosome with 2 genomes, the genome 0 is the condition part and the genome 1 is the action part.

Author:
Marco Lamieri and Gianluigi Ferraris

Constructor Summary
Classifier(CsConfiguration configuration, Population population)
          Constructor of the class.
 
Method Summary
 void addActivatorToList(Author author)
          Add the author to the activators list.
 void clearActivatorsList()
          Clear the activators list.
 void collect(double money)
          The implementing class collect the money payed by the winner of the auction to it's author.
 double computeBid()
          Compute the bid for auction if not already computed.
 Gene[] getAction()
          Return the action part (genome 1)
 java.util.ArrayList getActivatorsList()
          List of message that activate the classifier.
 java.lang.String getAlleleWithWildcard(int a)
          Return the allele in a printable format.
 double getBid()
          Get the bid for auction, compute it first.
 Gene[] getCondition()
          Return the condition part (genome 0)
 double getSpecificity()
          Specificity of the chromosome.
 void initializeChromosome()
          Initialize the Chromosome with generated genomes.
 boolean isBidComputed()
          Check if bid has been computed.
 boolean isSpecificityEvaluated()
          Check if specificity has been computed.
 double payBidTax()
          Pay bid tax for auction.
 double payLifeTax()
          Pay life tax at every cycle.
 void payToActivators()
          Pay bid/numberOfActivators to each activator of the classifier (BucketBrigade algorithm)
 void print()
          Print to screen some Chromosome's information.
 void setAction(Gene[] action)
          Set the action part (genome 1).
 void setBidComputed(boolean bidComputed)
          Set bid computed.
 void setCondition(Gene[] condition)
          Set the condition part (genome 0).
 void setSpecificityEvaluated(boolean specificityEvaluated)
          Set specificity evaluated.
 
Methods inherited from class art.ga.Chromosome
getAge, getBody, getChild, getFitness, getGenome, getMyPopulation, getNumberOfRules, getRescaledFitness, getRule, getSelectedForDie, getSelectedForReproduction, isFitnessEvaluated, print, setAge, setBody, setChild, setFitness, setFitnessEvaluated, setRescaledFitness, setRescaledFitnessEvaluated, setSelectedForDie, setSelectedForReproduction
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Classifier

public Classifier(CsConfiguration configuration,
                  Population population)
Constructor of the class.

Parameters:
configuration - COnfiguration.
population - Population belonging to.
Method Detail

getActivatorsList

public java.util.ArrayList getActivatorsList()
List of message that activate the classifier. (BucketBrigade algorithm)

Returns:
List of message.

payToActivators

public void payToActivators()
Pay bid/numberOfActivators to each activator of the classifier (BucketBrigade algorithm)


collect

public void collect(double money)
Description copied from interface: Author
The implementing class collect the money payed by the winner of the auction to it's author.

Specified by:
collect in interface Author
Parameters:
money - Money collected.

payBidTax

public double payBidTax()
Pay bid tax for auction.

Returns:
if payed.

payLifeTax

public double payLifeTax()
Pay life tax at every cycle.

Returns:
if payed.

clearActivatorsList

public void clearActivatorsList()
Clear the activators list.


getAction

public Gene[] getAction()
Return the action part (genome 1)

Returns:
Returns the action.

computeBid

public double computeBid()
Compute the bid for auction if not already computed.

Returns:
Returns the bid.

getBid

public double getBid()
Get the bid for auction, compute it first.

Returns:
bid.

getCondition

public Gene[] getCondition()
Return the condition part (genome 0)

Returns:
Returns the condition.

getSpecificity

public double getSpecificity()
Specificity of the chromosome. It is computed as spec=(wildcardNumber-length)/length.

Returns:
Returns the specificity.

setAction

public void setAction(Gene[] action)
Set the action part (genome 1).

Parameters:
action - The action to set.

setCondition

public void setCondition(Gene[] condition)
Set the condition part (genome 0).

Parameters:
condition - The condition to set.

addActivatorToList

public void addActivatorToList(Author author)
Add the author to the activators list.

Parameters:
author - author to add.

isSpecificityEvaluated

public boolean isSpecificityEvaluated()
Check if specificity has been computed.

Returns:
Returns the specificityEvaluated.

setSpecificityEvaluated

public void setSpecificityEvaluated(boolean specificityEvaluated)
Set specificity evaluated.

Parameters:
specificityEvaluated - The specificityEvaluated to set.

isBidComputed

public boolean isBidComputed()
Check if bid has been computed.

Returns:
Returns the bidComputed.

setBidComputed

public void setBidComputed(boolean bidComputed)
Set bid computed.

Parameters:
bidComputed - The bidComputed to set.

initializeChromosome

public void initializeChromosome()
Description copied from class: Chromosome
Initialize the Chromosome with generated genomes.

Overrides:
initializeChromosome in class Chromosome

print

public void print()
Description copied from class: Chromosome
Print to screen some Chromosome's information.

Specified by:
print in interface GaSolution
Overrides:
print in class Chromosome

getAlleleWithWildcard

public java.lang.String getAlleleWithWildcard(int a)
Return the allele in a printable format. Wildcard are displayed as # and not as "2".

Parameters:
a - String to verify (use getAllele()).
Returns:
Display value.