java - Adding non linear function TinyGp -


i trying extend function set of tinygp software include non linear functions, such sin, cos , tan. problem is, growing tree functions take single paramater , performing crossover of tree containing functions 1 parameter functions
source code of printing method outlined below.

int grow( char [] buffer, int pos, int max, int depth )  { char prim = (char) rd.nextint(2); int one_child;  if ( pos >= max )    return( -1 );  if ( pos == 0 )   prim = 1;  if ( prim == 0 || depth == 0 ) {   prim = (char) rd.nextint(varnumber + randomnumber);   buffer[pos] = prim;   return(pos+1);   } else  {   prim = (char) (rd.nextint(fset_end - fset_start + 1) + fset_start);   switch(prim) {   case add:    case sub:    case mul:    case div:     buffer[pos] = prim; one_child = grow( buffer, pos+1, max,depth-1); if ( one_child < 0 )      return( -1 );     return( grow( buffer, one_child, max,depth-1 ) );   } } return( 0 ); // should never here 

}


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -