physis.core.virtualmachine
Class PhysisVMTracer

java.lang.Object
  |
  +--physis.core.virtualmachine.PhysisVMTracer
All Implemented Interfaces:
Environment, java.util.EventListener, InteractionEventListener, ProliferationEventListener

public final class PhysisVMTracer
extends java.lang.Object
implements Environment

A separate tool for running one virtualmachine. The execution can be monitored.


Field Summary
private static int INFINITE_LOOP
          The number of executed instructions which can be considered as inifinite loop.
private  int input_data_higher_bound
           
private static java.lang.String INPUT_DATA_HIGHER_BOUND
           
private  DigitalOrganism org
           
private  GeneticCodeTape orig
           
private  java.util.Random rnd
           
private static java.lang.String TASK_FILE
           
private  TaskLibrary tasklibrary
           
private  PhysisVirtualMachine vm
           
 
Constructor Summary
PhysisVMTracer()
           
 
Method Summary
 boolean copyShouldBeMutated()
          Answers the question: Should the current copied instruction be mutated?
 boolean divideShouldBeMutated()
          Answers the question: Should the current divided codetape be mutated?
 int getInputData()
          This provides the input from the environment (~food).
 LifeSpace getLifeSpace()
           
 DigitalOrganism getNeighbourRandomly(DigitalOrganism digorg)
          Returns one organism of the neighbours of the organism specified by the parameter.
 java.util.Random getRandom()
          The only one random-generator in one Physis-instance should be in the environment.
 TaskLibrary getTaskLibrary()
          Returns the tasklibrary.
 void interactionOccured(InteractionEvent ie)
          Performed when an organism interacts with its environment.
static void main(java.lang.String[] args)
           
 void proliferationPerformed(ProliferationEvent pe)
          When a digital organism divides the new organism must be placed somewhere in the lifespace and the old organism's effective length should be recalculated.
 void rotateForward(DigitalOrganism digorg)
          Rotates the organism's facing forward.
 void setLifeSpace(LifeSpace lifespace_)
           
 boolean shouldBeDeleted()
          Answers the question: Should the current divided codetape be deleted one instruction?
 boolean shouldBeInserted()
          Answers the question: Should the current divided codetape be inserted extra instructions?
private static void usage()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

TASK_FILE

private static java.lang.String TASK_FILE

INPUT_DATA_HIGHER_BOUND

private static java.lang.String INPUT_DATA_HIGHER_BOUND

INFINITE_LOOP

private static final int INFINITE_LOOP
The number of executed instructions which can be considered as inifinite loop.

tasklibrary

private TaskLibrary tasklibrary

rnd

private java.util.Random rnd

org

private DigitalOrganism org

vm

private PhysisVirtualMachine vm

orig

private GeneticCodeTape orig

input_data_higher_bound

private int input_data_higher_bound
Constructor Detail

PhysisVMTracer

public PhysisVMTracer()
Method Detail

main

public static void main(java.lang.String[] args)

usage

private static void usage()

getTaskLibrary

public TaskLibrary getTaskLibrary()
Returns the tasklibrary.
Specified by:
getTaskLibrary in interface Environment

setLifeSpace

public void setLifeSpace(LifeSpace lifespace_)
Specified by:
setLifeSpace in interface Environment

getLifeSpace

public LifeSpace getLifeSpace()
Specified by:
getLifeSpace in interface Environment

interactionOccured

public void interactionOccured(InteractionEvent ie)
Description copied from interface: InteractionEventListener
Performed when an organism interacts with its environment.
Specified by:
interactionOccured in interface InteractionEventListener

proliferationPerformed

public void proliferationPerformed(ProliferationEvent pe)
Description copied from interface: ProliferationEventListener
When a digital organism divides the new organism must be placed somewhere in the lifespace and the old organism's effective length should be recalculated. The parent organism's VM should be reset. The parent orgainsm should be set fertile. These should be handled in this method by the implementor classes.
Specified by:
proliferationPerformed in interface ProliferationEventListener

getInputData

public int getInputData()
This provides the input from the environment (~food).
Specified by:
getInputData in interface Environment

rotateForward

public void rotateForward(DigitalOrganism digorg)
Rotates the organism's facing forward.
Specified by:
rotateForward in interface Environment

copyShouldBeMutated

public boolean copyShouldBeMutated()
Answers the question: Should the current copied instruction be mutated?
Specified by:
copyShouldBeMutated in interface Environment

divideShouldBeMutated

public boolean divideShouldBeMutated()
Answers the question: Should the current divided codetape be mutated?
Specified by:
divideShouldBeMutated in interface Environment

shouldBeInserted

public boolean shouldBeInserted()
Answers the question: Should the current divided codetape be inserted extra instructions?
Specified by:
shouldBeInserted in interface Environment

shouldBeDeleted

public boolean shouldBeDeleted()
Answers the question: Should the current divided codetape be deleted one instruction?
Specified by:
shouldBeDeleted in interface Environment

getNeighbourRandomly

public DigitalOrganism getNeighbourRandomly(DigitalOrganism digorg)
Description copied from interface: Environment
Returns one organism of the neighbours of the organism specified by the parameter.
Specified by:
getNeighbourRandomly in interface Environment

getRandom

public java.util.Random getRandom()
Description copied from interface: Environment
The only one random-generator in one Physis-instance should be in the environment. There shouldn't be more than one, otherwise accurate experiment repeat would be impossible.
Specified by:
getRandom in interface Environment