|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.encog.ml.prg.EncogProgramContext
public class EncogProgramContext
Every EncogProgram must belong to a context. When programs are in a population, they must all share a common context. The context defines attributes that are common to all programs. The following information is stored in a context. The number formatting used. Namely, what type of radix point should strings be parsed/rendered to. The functions, or opcodes, that are available to the program. This defines the set of functions & operators that a program might use. For an Encog Program all operators are treated as functions internally. A operator is essentially a shortcut notation for common functions. The defined variables. These variables are constant for the run of the program, but typically change for each run. They are essentially the variables that make up an algebraic expression. Finally, the return value mapping for the programs.
Constructor Summary | |
---|---|
EncogProgramContext()
Construct the context with an English number format and an empty function factory. |
|
EncogProgramContext(CSVFormat format)
Construct a context with the specified number format and an empty function factory. |
|
EncogProgramContext(CSVFormat theFormat,
FunctionFactory theFunctions)
Construct the context with the specified format and function factory. |
Method Summary | |
---|---|
void |
clearDefinedVariables()
Clear the defined variables. |
ProgramNode |
cloneBranch(EncogProgram targetProgram,
ProgramNode sourceBranch)
Clone a branch of the program from the specified node. |
EncogProgram |
cloneProgram(EncogProgram sourceProgram)
Clone an entire program, keep the same context. |
EncogProgram |
createProgram(String expression)
Create a new program, using this context. |
void |
defineVariable(String theName)
Define the specified variable as floating point. |
void |
defineVariable(String theName,
ValueType theVariableType)
Define the specified variable as the specified type. |
void |
defineVariable(String theName,
ValueType theVariableType,
int theEnumType,
int theEnumValueCount)
Define a variable. |
void |
defineVariable(VariableMapping mapping)
Define a variable, based on a mapping. |
List<VariableMapping> |
findVariablesByTypes(List<ValueType> desiredTypes)
Find all of the variables of the specified types. |
List<VariableMapping> |
getDefinedVariables()
|
int |
getEnumCount(int enumType)
Get the enum ordinal count for the specified enumeration type. |
CSVFormat |
getFormat()
|
FunctionFactory |
getFunctions()
|
int |
getMaxEnumType()
Get the max enum type for all defined variables. |
VariableMapping |
getResult()
|
boolean |
hasEnum()
|
void |
loadAllFunctions()
Load all known functions as opcodes. |
void |
setResult(VariableMapping result)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EncogProgramContext()
public EncogProgramContext(CSVFormat format)
format
- The format.public EncogProgramContext(CSVFormat theFormat, FunctionFactory theFunctions)
theFormat
- The format.theFunctions
- The function factory.Method Detail |
---|
public void clearDefinedVariables()
public ProgramNode cloneBranch(EncogProgram targetProgram, ProgramNode sourceBranch)
targetProgram
- The program that this branch will be "grafted" into.sourceBranch
- The branch to clone, from the source program.
public EncogProgram cloneProgram(EncogProgram sourceProgram)
sourceProgram
- The source program.
public EncogProgram createProgram(String expression)
expression
- The common expression to compile.
public void defineVariable(String theName)
theName
- The variable name to define.public void defineVariable(String theName, ValueType theVariableType)
theName
- The name of the variable.theVariableType
- The variable type.public void defineVariable(String theName, ValueType theVariableType, int theEnumType, int theEnumValueCount)
theName
- The name of the variable.theVariableType
- The type of variable.theEnumType
- The enum type, not used if not an enum type.theEnumValueCount
- The number of values for the enum, not used if not an enum
type.public void defineVariable(VariableMapping mapping)
mapping
- The variable mapping.public List<VariableMapping> findVariablesByTypes(List<ValueType> desiredTypes)
desiredTypes
- The types to look for.
public List<VariableMapping> getDefinedVariables()
public int getEnumCount(int enumType)
enumType
- The enumeration type.
public CSVFormat getFormat()
public FunctionFactory getFunctions()
public int getMaxEnumType()
public VariableMapping getResult()
public boolean hasEnum()
public void loadAllFunctions()
public void setResult(VariableMapping result)
result
- the result to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |