Class Member

java.lang.Object
  |
  +--Member

public class Member
extends java.lang.Object


Field Summary
static int NUM_OF_ATTRIBUTES
          The number of attributes each member has.
 
Constructor Summary
Member()
           
 
Method Summary
 java.lang.String display()
          Returns a binary representation of the member's attributes.
 double fitness()
          Calculates the fitness of the member.
 boolean[] getAttributes()
          Returns the boolean attributes of the member.
 double getProbability()
          Returns the probability of the member.
 void Member()
          Creates the member.
 void mutate()
          Mutates the member by randomly toggling one of its attributes.
 void setAttributeAt(int i, boolean b)
          Sets the boolean attributes i of the member to b.
 void setAttributes()
          Randomly selects a boolean value for the member.
 void setProbability(double p)
          Sets the probability associated with the member.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUM_OF_ATTRIBUTES

public static final int NUM_OF_ATTRIBUTES
The number of attributes each member has.

See Also:
Constant Field Values
Constructor Detail

Member

public Member()
Method Detail

Member

public void Member()
Creates the member.


setAttributes

public void setAttributes()
Randomly selects a boolean value for the member.


fitness

public double fitness()
Calculates the fitness of the member.

Returns:
The fitness of the member.

setProbability

public void setProbability(double p)
Sets the probability associated with the member. It's probability if calculated in relation to other members in the population.

Parameters:
p - The probability associated with the member.

getProbability

public double getProbability()
Returns the probability of the member.

Returns:
The probability of the member.

getAttributes

public boolean[] getAttributes()
Returns the boolean attributes of the member.

Returns:
The array of attributes.

setAttributeAt

public void setAttributeAt(int i,
                           boolean b)
Sets the boolean attributes i of the member to b.

Parameters:
i - The attribute to be set.
b - The boolean value.

mutate

public void mutate()
Mutates the member by randomly toggling one of its attributes.


display

public java.lang.String display()
Returns a binary representation of the member's attributes.

Returns:
A string of binary values