codesimian
Annotation Type codsimEvolvableFunc


public @interface codsimEvolvableFunc

Put this annotation on any java-function that you want CodeSimian to possibly choose to modify. A measure of code and reward (a simple number) are specified, to motivate CodeSimian to evolve/design something you define by the measure (an anonymous function)


Required Element Summary
 java.lang.String[] bestCodesSoFar
          Returns a prioritized list of codesimian-code that does at least approximately (close enough) what [the function this codsimEvolvableFunc refers to] does.
 java.lang.String do2RetsEq
          measures 2 return values.
 java.lang.String[] dynamicInputLists
          Returns a prioritized list of codesimian-code-strings.
 
Optional Element Summary
 java.lang.String measureProposedCode
          Returns a prioritized list of codesimian-code-strings.
 java.lang.String testsPerMeasure
          A test is when proposed code's and the target java-function's return values are compared.
 java.lang.String totalReward
          the total REWARD (usually Liquid objects) given for increasing the MEASURE (an anonymous function) by writing java code to replace the function that this codesimEvolvableFunc refers to.
 

Element Detail

bestCodesSoFar

public abstract java.lang.String[] bestCodesSoFar
Returns a prioritized list of codesimian-code that does at least approximately (close enough) what [the function this codsimEvolvableFunc refers to] does.

P(0) of the code (after compiled) becomes the return-value of the simulation of the function. P(1) is the instance object that the function is called from in the simulation. P(2) and higher are the parameters of the simulated function. countP() == quantity of parameters of the simulated function plus 2. If the function is void and/or static, P(0) and P(1) are ignored, but must exist.


dynamicInputLists

public abstract java.lang.String[] dynamicInputLists
Returns a prioritized list of codesimian-code-strings.

Before any of this occurs, the proposed code must pass MEASURE, which means measure().setP(0,the proposed code as a string) then measure().Z() is the measurement.

codesimian-code for a list whose size equals quantity of parameters of the target function. CSs in the list should change each time they are observed. For example, a self-randomizing number. Or, for example, if the target function uses java.awt.Component instead of double numbers, the things in the list should return a different Component each time they're observed.

The dynamic things in this list should be usable in the following way: I will choose 1 of OLD JAVA FUNCTION and NEW CODESIMIAN CODE TO BE CONVERTED TO JAVA to be first and the other second. Each will have these objects/primitives input and will return something. Then the other will have the SAME objects/primitives the same way and will return something. Then MEASURE2RETS() compares them. If MEASURE2RETS returns positive, this one test (among many) passes. If all tests pass, some fraction (or possibly all) REWARD is given.


do2RetsEq

public abstract java.lang.String do2RetsEq
measures 2 return values. One is the return value of the target function when DYNAMICINPUTLIST is input into it. The other is the P(0), which represents return-value, of the proposed network of CSs that will be converted to Java code if MEASURE2RETS returns positive for all values of DYNAMICINPUTLIST that are tested on both the proposed code and the target java-function.

measureProposedCode

public abstract java.lang.String measureProposedCode
Returns a prioritized list of codesimian-code-strings.

Each is codesimian-code for an anonymous function that measures its P(0). P(0) is used as a String, is judged, and the compiled measure() returns 0 or negative if the code fails (may not replace the code of the function this codsimEvolvableFunc refers to) or returns positive (may replace that code).

ERROR: now 6/2007: The default codesimian code "func#acceptCompilable(0#code compile(0 code))" will only work after codesimian.JavaMethod2 is modified to initialize after first REmodification of any parameter instead of first execution. This text should be removed after that.

Default:
"func#acceptCompilable(0#code compile(0 code))"

testsPerMeasure

public abstract java.lang.String testsPerMeasure
A test is when proposed code's and the target java-function's return values are compared. Each test, DYNAMICINPUTLIST is used to generate new inputs. The exact same input objects (or primitives) are used 2 times each test. Default is 1 million tests. Most implementors of this @interface codsimEvolvableFunc will want a smaller quantity of tests because extreme accuracy can be obtained with much less quantity of tests. I chose 1 million because most tests will not want more, and a default should satisfy most.

Default:
"1e6()"

totalReward

public abstract java.lang.String totalReward
the total REWARD (usually Liquid objects) given for increasing the MEASURE (an anonymous function) by writing java code to replace the function that this codesimEvolvableFunc refers to.

The MEASURE of what CODE() returns will not give any REWARD, but any higher MEASURE may give part of all of the REWARD that has not been output yet.

There is a fixed amount of REWARD per program execution (or per CPU time? or per Human user?) for each java function that has a codsimEvolvableFunc. By writing better and better code, that REWARD can be gradually obtained.

Default: returns 1 billion total reward.

Default:
"1e9()"