These pages are auto-generated from self-documenting comments embedded in class files.
For more information on breve and steve, refer to the breve homepage.

Object : PushInterpreter

Class description:

Summary: an interface to the Push programming language.

The PushInterpreter object is used to setup and run programs in the Push programming language, a language developed specifically for evolutionary computation.

Push is useful in breve for evolving evolved agent behaviors. The steve language, in which users write simulations, is a high level language which is not well suited for evolutionary computation. The Push language, on the other hand, is designed from the ground up for evolutionary computation.

More information about Push is available here.

Methods:

  • addInstruction
  • addMacro
  • clearStacks
  • copyCodeStackTop
  • copyExecStackTop
  • getBooleanStackSize
  • getBooleanStackTop
  • getCodeStackSize
  • getEffort
  • getEvaluationLimit
  • getExecStackSize
  • getFloatStackSize
  • getFloatStackTop
  • getIntegerStackSize
  • getIntegerStackTop
  • getInterpreterPointer
  • getListLimit
  • getVectorStackSize
  • getVectorStackTop
  • popBooleanStack
  • popCodeStack
  • popExecStack
  • popFloatStack
  • popIntegerStack
  • popVectorStack
  • printConfig
  • printExecStack
  • printStacks
  • pushBoolean
  • pushCode
  • pushExec
  • pushFloat
  • pushInteger
  • pushVector
  • readConfig
  • resetEffort
  • run
  • runWithExecStackDump
  • setEvaluationLimit
  • setListLimit
  • step
    addInstruction( self, targetInstance, methodName, instructionName )

    Adds a custom callback instruction named instructionName to the push interpreter. When instructionName is called, it will trigger the method methodName in targetInstance. If the instruction name is not specified, methodName will be used.


    addMacro( self, instructionName, code )

    Adds a new instruction named instructionName, which has the effect of calling the instructions in code.


    clearStacks( self )

    Clears the stacks of the Push interpreter.


    copyCodeStackTop( self, program )

    Copies the top of the code stack to an existing program. Use get-code-stack-size to determine whether the code stack is empty or not.


    copyExecStackTop( self, program )

    Copies the top of the code stack to an existing program. Use get-exec-stack-size to determine whether the code stack is empty or not.


    getBooleanStackSize( self )

    Returns the size of the boolean stack.


    getBooleanStackTop( self )

    Returns the top of the boolean stack. If the boolean stack is empty, the method returns 0 (false). Use get-boolean-stack-size to determine whether the boolean stack is empty or not.


    getCodeStackSize( self )

    Returns the size of the code stack.


    getEffort( self )

    Returns the "effort" of the Push interpreter--the running tally of instructions the interpreter has executed. for associating energy costs with computation in evolving populations.


    getEvaluationLimit( self )

    Returns the current push evaluation limit. See set-evaluation-limit for more information on the evaluation limit.


    getExecStackSize( self )

    Returns the size of the code stack.


    getFloatStackSize( self )

    Returns the size of the float stack.


    getFloatStackTop( self )

    Returns the top of the float stack. If the float stack is empty, the method returns 0.0. Use get-float-stack-size to determine whether the boolean stack is empty or not.


    getIntegerStackSize( self )

    Returns the size of the integer stack.


    getIntegerStackTop( self )

    Returns the top of the interger stack. If the integer stack is empty, the method returns 0. Use get-integer-stack-size to determine whether the integer stack is empty or not.


    getInterpreterPointer( self )

    Used internally.


    getListLimit( self )

    Returns the size limit of lists constructed in push. See set-list-limit for more information.


    getVectorStackSize( self )

    Returns the size of the vector stack.


    getVectorStackTop( self )

    Returns the top of the vector stack. If the vector stack is empty, the method returns (0, 0, 0). Use get-vector-stack-size to determine whether the vector stack is empty or not.


    popBooleanStack( self )

    Pops the boolean stack. If the boolean stack is empty, this method has no effect.


    popCodeStack( self )

    Pops the code stack. If the code stack is empty, this method has no effect.


    popExecStack( self )

    Pops the exec stack. If the code stack is empty, this method has no effect.


    popFloatStack( self )

    Pops the float stack. If the float stack is empty, this method has no effect.


    popIntegerStack( self )

    Pops the integer stack. If the integer stack is empty, this method has no effect.


    popVectorStack( self )

    Pops the vector stack. If the vector stack is empty, this method has no effect.


    printConfig( self )

    Prints out the current push configuration, including a list of the active instructions. Useful for debugging.


    printExecStack( self )

    Prints out the current contents of the exec stack. Useful for debugging.


    printStacks( self )

    Prints out the current contents of the stacks. Useful for debugging.


    pushBoolean( self, booleanValue )

    Pushes the boolean booleanValue (an integer in breve, where 0 is false and all other values are true) onto the boolean stack.


    pushCode( self, codeObject )

    Pushes the code codeObject onto the code stack.


    pushExec( self, codeObject )

    Pushes the code codeObject onto the exec stack.


    pushFloat( self, floatValue )

    Pushes the float floatValue onto the float stack.


    pushInteger( self, integerValue )

    Pushes the integer integerValue onto the integer stack.


    pushVector( self, vectorValue )

    Pushes the vector vectorValue onto the vector stack.


    readConfig( self, configFile )

    Reads the push configuration file configFile.


    resetEffort( self )

    Clears the effort counter to 0.


    run( self, codeObject, steps )

    Runs the specified push code from the beginning of the program. If the steps variable is provided, evaluation will only run for the specified number of instructions. Otherwise, evaluation will run for the evaluation limit, which is set with set-evaluation-limit.

    The method returns 0 if the interpreter completely executes the program, or 1 if execution stopped due to the evaluation limit.

    If the program is not executed completely, execution may be stepped forward using the method step. In some cases, it may be desirable to step push programs forward in small increments by calling this method with steps = 0 in order to load the program, then using step to step the simulatation forward.


    runWithExecStackDump( self, codeObject, steps )

    Dumps out the exec stack at every instruction step. Extremely verbose. For debugging only.


    setEvaluationLimit( self, newLimit )

    Sets the evaluation limit to newLimit. This specifies the number of instructions to run when the run is called. The default value for a new interpreter is 200.


    setListLimit( self, newLimit )

    Sets the size limit of lists constructed in push. This limit also applies to programs created using genetic operators. The default limit is 200.


    step( self, steps )

    Steps the interpreter forward by the specified number of instructions.