Package jcgp.backend.resources

Examples of jcgp.backend.resources.Resources.arity()


  @Override
  public void mutate() {
    Resources resources = chromosome.getResources();
   
    // choose to mutate the function or a connection
    int geneType = resources.getRandomInt(1 + resources.arity());
   
    // if the int is less than 1, mutate function, else mutate connections
    if (geneType < 1) {     
      setFunction(resources.getRandomFunction());
    } else {
View Full Code Here


    guiNodes = new GUINode[rows][columns];
    double angle, xPos, yPos;
    for (int r = 0; r < rows; r++) {
      for (int c = 0; c < columns; c++) {
        // make the connection lines
        Line lines[] = new Line[resources.arity()];
        for (int l = 0; l < lines.length; l++) {
          angle = ((((double) (l + 1)) / ((double) (lines.length + 1))) * Constants.THETA) - (Constants.THETA / 2);
          xPos = (-Math.cos(angle) * Constants.NODE_RADIUS) + (((c + 1) * (2 * Constants.NODE_RADIUS + Constants.SPACING)) + Constants.NODE_RADIUS);
          yPos = (Math.sin(angle) * Constants.NODE_RADIUS) + ((r * (2 * Constants.NODE_RADIUS + Constants.SPACING)) + Constants.NODE_RADIUS);
         
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.