edu.uiuc.ge.illigal.gale.board
Class Board

java.lang.Object
  |
  +--edu.uiuc.ge.illigal.gale.board.Board

public class Board
extends java.lang.Object

This class contains the Ale proposal based on CGA

Since:
0.9alpha
Version:
0.9alpha
Author:
Xavier Llorà <xllora@illigal.ge.uiuc.edu>

Field Summary
protected  edu.uiuc.ge.illigal.gale.agents.Agent agnBest
          Best Agent found along the run
protected  edu.uiuc.ge.illigal.gale.agents.Agent[][][] agnGen
          The 2D board
protected  edu.uiuc.ge.illigal.gale.agents.AgentPerformance[][] agnPer
          The current agent performance
protected  boolean[][] baAllIns
          The mapping of the folder in the training set contains all the instances
protected  boolean bDump
          Dump board flag
protected  edu.uiuc.ge.illigal.gale.config.GALEConfiguration galeCnf
          GALE configuration object
protected  int iBoard
          The current board in use
protected  int iMaxX
          Maximum width
protected  int iMaxY
          Maximum height
protected  edu.uiuc.ge.illigal.gale.data.InstanceSet insSet
          GALE training instance set
protected  edu.uiuc.ge.illigal.gale.io.IOFactory ioFac
          IOFactory used for logs
protected  edu.uiuc.ge.illigal.gale.data.OrderedSet[] osaFolds
          The array of fold to use for cross-validation
protected  edu.uiuc.ge.illigal.gale.data.OrderedSet[][] osaMapping
          The mapping of the folder in the training set
protected  java.util.Random rnd
          Random number generator
 
Constructor Summary
Board(edu.uiuc.ge.illigal.gale.config.GALEConfiguration gale, edu.uiuc.ge.illigal.gale.data.InstanceSet ins, edu.uiuc.ge.illigal.gale.data.OrderedSet[] osa, edu.uiuc.ge.illigal.gale.io.IOFactory io, boolean bD)
          Builds a board initializing all the data.
 
Method Summary
protected  void arrangeMapping(edu.uiuc.ge.illigal.gale.data.OrderedSet os)
          Arranges the data mapping over the board.
 edu.uiuc.ge.illigal.gale.agents.Agent bestAgent()
          Returns the best agent obtained along the run.
protected  int[] bestNeighbour(int i, int j)
          Returns the position of the best neighbor for a given cell
protected  void computePerformance()
          Computes the number of samples covered by the individual.
protected  void computeStatistics(int iIter, int iMax)
          Compute the statistics of the board.
protected  int countNeighbours(int i, int j)
          Count the number of neighbors for a given cell position.
protected  edu.uiuc.ge.illigal.gale.agents.Agent crossingNeighbour(int i, int j)
          Returns the crossingNeighbour.
protected  void evolveBoard()
          Evolve the board
 edu.uiuc.ge.illigal.gale.agents.Agent[] fullMappedAgents()
          Returns the full mapped agents
protected  int[] getIthNeighbour(int i, int j, int iNei)
          Returns the ith neighbor
protected  void initializeStatistics()
          Initializes the statistics information.
protected  void merge()
          Implements the merge phase
protected  float neighbourMean(int i, int j)
          Computes the neighbor mean eval of the neighborhood of the given cell .
protected  float neighbourStdDev(int i, int j, float fMean)
          Computes the standard deviation of the neighborhood scaled accuracy of the given cell .
protected  void pyramidTailNumberMapping(edu.uiuc.ge.illigal.gale.data.OrderedSet os)
          Arranges the data mapping over the board
protected  void randomMapping(edu.uiuc.ge.illigal.gale.data.OrderedSet os)
          Arranges the data mapping over the board with random sampling
 void runFold(int iFold, java.lang.String sPre)
          Builds a board initializing all the data.
 void split()
          Split phase.
protected  int[] splitTargetPosition(int i, int j)
          Calculates the destination of the splitted agent on the board.
protected  void survival()
          Implements the survival phase
protected  void traceAccuracy()
          Traces the accuracy board.
protected  void traceComplexity()
          Traces the complexity board.
protected  void traceSummary(int iIter)
          Summaries the
protected  void uniformMapping(edu.uiuc.ge.illigal.gale.data.OrderedSet os)
          Arranges the data mapping over the board uniformly
protected  void updatePerformance()
          Updates the performance references.
private  int[] worstNeighbour(int i, int j)
          Returns the worst neighbor for the given cell.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

galeCnf

protected edu.uiuc.ge.illigal.gale.config.GALEConfiguration galeCnf
GALE configuration object


insSet

protected edu.uiuc.ge.illigal.gale.data.InstanceSet insSet
GALE training instance set


osaFolds

protected edu.uiuc.ge.illigal.gale.data.OrderedSet[] osaFolds
The array of fold to use for cross-validation


ioFac

protected edu.uiuc.ge.illigal.gale.io.IOFactory ioFac
IOFactory used for logs


rnd

protected java.util.Random rnd
Random number generator


agnGen

protected edu.uiuc.ge.illigal.gale.agents.Agent[][][] agnGen
The 2D board


iBoard

protected int iBoard
The current board in use


agnPer

protected edu.uiuc.ge.illigal.gale.agents.AgentPerformance[][] agnPer
The current agent performance


iMaxX

protected int iMaxX
Maximum width


iMaxY

protected int iMaxY
Maximum height


osaMapping

protected edu.uiuc.ge.illigal.gale.data.OrderedSet[][] osaMapping
The mapping of the folder in the training set


baAllIns

protected boolean[][] baAllIns
The mapping of the folder in the training set contains all the instances


agnBest

protected edu.uiuc.ge.illigal.gale.agents.Agent agnBest
Best Agent found along the run


bDump

protected boolean bDump
Dump board flag

Constructor Detail

Board

public Board(edu.uiuc.ge.illigal.gale.config.GALEConfiguration gale,
             edu.uiuc.ge.illigal.gale.data.InstanceSet ins,
             edu.uiuc.ge.illigal.gale.data.OrderedSet[] osa,
             edu.uiuc.ge.illigal.gale.io.IOFactory io,
             boolean bD)
Builds a board initializing all the data.

Parameters:
gale - The GALE environment configuration object
ins - The instance set available
osa - The array of folds for cross-validation
io - The IOFactory to use
bD - Dumps the board trace
Method Detail

runFold

public void runFold(int iFold,
                    java.lang.String sPre)
             throws java.lang.Exception
Builds a board initializing all the data.

Parameters:
iFold - the fold to be run. -1 runs the whole instance set.
sPre - the preface file information
Throws:
java.lang.Exception - Not valid mapping strategy

bestAgent

public edu.uiuc.ge.illigal.gale.agents.Agent bestAgent()
Returns the best agent obtained along the run.

Returns:
the best agent

fullMappedAgents

public edu.uiuc.ge.illigal.gale.agents.Agent[] fullMappedAgents()
Returns the full mapped agents

Returns:
the set of agents

evolveBoard

protected void evolveBoard()
                    throws java.lang.Exception
Evolve the board

Throws:
java.lang.Exception - exception raise in some of the phase of GALE

split

public void split()
           throws java.lang.Exception
Split phase.

Throws:
java.lang.Exception - exception raise in some of the phase of GALE

splitTargetPosition

protected int[] splitTargetPosition(int i,
                                    int j)
Calculates the destination of the splitted agent on the board.

Parameters:
i - The Y position of the agent
j - The X position of the agent
Returns:
The target position

worstNeighbour

private int[] worstNeighbour(int i,
                             int j)
Returns the worst neighbor for the given cell.

Parameters:
i - The Y position of the agent
j - The X position of the agent
Returns:
The worst position

merge

protected void merge()
              throws java.lang.Exception
Implements the merge phase

Throws:
java.lang.Exception - could not clone an agent

crossingNeighbour

protected edu.uiuc.ge.illigal.gale.agents.Agent crossingNeighbour(int i,
                                                                  int j)
Returns the crossingNeighbour.

Parameters:
i - The y position of the current agent in the board
j - The x position of the current agent in the board
Returns:
the mergingNeighbour agent

getIthNeighbour

protected int[] getIthNeighbour(int i,
                                int j,
                                int iNei)
Returns the ith neighbor

Parameters:
i - The y position of the cell
j - The x position of the cell
iNei - The neighbor searched
Returns:
The position of the neighbor

survival

protected void survival()
                 throws java.lang.Exception
Implements the survival phase

Throws:
java.lang.Exception - could not clone an agent

updatePerformance

protected void updatePerformance()
Updates the performance references.

Returns:
The number of neighbors

countNeighbours

protected int countNeighbours(int i,
                              int j)
Count the number of neighbors for a given cell position.

Parameters:
i - The y position
j - The x position
Returns:
The number of neighbors

bestNeighbour

protected int[] bestNeighbour(int i,
                              int j)
Returns the position of the best neighbor for a given cell

Parameters:
i - The y position
j - The x position
Returns:
the best neighbor position

neighbourMean

protected float neighbourMean(int i,
                              int j)
Computes the neighbor mean eval of the neighborhood of the given cell .

Parameters:
i - The y position
j - The x position
Returns:
the mean scaled accuracy of the neighborhood

neighbourStdDev

protected float neighbourStdDev(int i,
                                int j,
                                float fMean)
Computes the standard deviation of the neighborhood scaled accuracy of the given cell .

Parameters:
i - The y position
j - The x position
fMean - the mean value
Returns:
the standard deviation of the accuracy in the neighborhood

initializeStatistics

protected void initializeStatistics()
Initializes the statistics information.


computeStatistics

protected void computeStatistics(int iIter,
                                 int iMax)
                          throws java.lang.Exception
Compute the statistics of the board.

Parameters:
iIter - current board iteration
Throws:
java.lang.Exception - Not valid mapping strategy

traceSummary

protected void traceSummary(int iIter)
                     throws java.lang.Exception
Summaries the

java.lang.Exception

traceAccuracy

protected void traceAccuracy()
                      throws java.lang.Exception
Traces the accuracy board.

java.lang.Exception

traceComplexity

protected void traceComplexity()
                        throws java.lang.Exception
Traces the complexity board.

java.lang.Exception

arrangeMapping

protected void arrangeMapping(edu.uiuc.ge.illigal.gale.data.OrderedSet os)
                       throws java.lang.Exception
Arranges the data mapping over the board.

Parameters:
os - The set of available instances
Throws:
java.lang.Exception - Not valid mapping strategy

computePerformance

protected void computePerformance()
                           throws java.lang.Exception
Computes the number of samples covered by the individual.

Throws:
java.lang.Exception - Problems appeared when cloning

uniformMapping

protected void uniformMapping(edu.uiuc.ge.illigal.gale.data.OrderedSet os)
Arranges the data mapping over the board uniformly

Parameters:
os - The set of available instances

randomMapping

protected void randomMapping(edu.uiuc.ge.illigal.gale.data.OrderedSet os)
Arranges the data mapping over the board with random sampling

Parameters:
os - The set of available instances

pyramidTailNumberMapping

protected void pyramidTailNumberMapping(edu.uiuc.ge.illigal.gale.data.OrderedSet os)
Arranges the data mapping over the board

Parameters:
os - The set of available instances