Trees | Indices | Help |
|
---|
|
Contains all parameters for the evolutionary run, grammar rules, constraints, and specifics about the terminal and function set of the trees in tutorial5. In this example, we evolve hybrid system: a model containing discrete values and logic operators and numerical operations. More specifically, we will evolve if_then_else types rules that will determine the application of different polynomials... from 20 sets of testing data (20 different values for x and y). Considering the constraints for building the trees, the root node will have 3 children, and these will be ordered ADF defining branches (we simply won't use ADF terminals nodes) describing the structure of the if then else statement. The solution found should be the equivalent of this expression: if x>y then cos(x) else sin(y)
A typical way to run the tutorial would be to:
>>> # setup for running tutorial 5 functions = tutorial5.functions crossover_mapping=tutorial5.crossover_mapping nb_eval=tutorial5.nb_eval ideal_results=tutorial5.GetIdealResultsData() terminals =tutorial5.terminals Strongly_Typed_Crossover_degree=tutorial5.Strongly_Typed_Crossover_degree Substitute_Mutation=tutorial5.Substitute_Mutation treeRules = tutorial5.treeRules adfOrdered = tutorial5.adfOrdered FitnessFunction = tutorial5.FitnessFunction
>>> def FitnessFunction(my_tree): >>> return evalfitness.FinalFitness3(evalfitness.EvalTreeForAllInputSets(my_tree,xrange(nb_eval)))
>>> import evolver if __name__ == "__main__": >>> dbname=r'C:\pop_db' >>> evolver.EvolutionRun(2000,(0,3,'root'),3,8,'AddHalfNode',100, 0.00001 ,0.5,0.49,7,0.8,dbname,True)
This means that we define:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Author: by Mehdi Khoury
Version: 1.20
Copyright: (c) 2009 Mehdi Khoury under the mit license http://www.opensource.org/licenses/mit-license.html
Contact: mehdi.khoury at gmail.com
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
functions = {'+': add, '-': sub, 'neg': neg, '*': multiply, '^
|
|||
nb_eval = 20
|
|||
all_x =
|
|||
all_y =
|
|||
terminals =
|
|||
ideal_results =
|
|||
crossover_mapping =
|
|||
defaultFunctionSet =
|
|||
defaultTerminalSet =
|
|||
treeRules =
|
|||
Strongly_Typed_Crossover_degree = 0
|
|||
Substitute_Mutation = 0
|
|||
adfOrdered = True
|
|||
__package__ = None
|
|||
i = 19
|
|
functions
|
all_x
|
all_y
|
terminals
|
defaultFunctionSet
|
treeRules
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 15 11:50:10 2009 | http://epydoc.sourceforge.net |