Package org.encog.ml.ea.exception

Examples of org.encog.ml.ea.exception.EACompileError


    // choose a random opcode
    final ProgramExtensionTemplate temp = generateRandomOpcode(rnd,
        opcodeSet);
    if (temp == null) {
      throw new EACompileError(
          "Trying to generate a random opcode when no opcodes exist.");
    }

    // create the child nodes
    final int childNodeCount = temp.getChildNodeCount();
View Full Code Here


    final ProgramExtensionTemplate temp = generateRandomOpcode(
        rnd,
        getContext().getFunctions().findOpcodes(types, this.context,
            true, false));
    if (temp == null) {
      throw new EACompileError("No opcodes exist for the type: "
          + types.toString());
    }
    final ProgramNode result = new ProgramNode(program, temp,
        new ProgramNode[] {});
View Full Code Here

    while (result == null) {
      final int opcode = rnd.nextInt(maxOpCode);
      result = opcodes.get(opcode);
      tries--;
      if (tries < 0) {
        throw new EACompileError(
            "Could not generate an opcode.  Make sure you have valid opcodes defined.");
      }
    }
    return result;
  }
View Full Code Here

      }

      // get the return type
      parser.eatWhiteSpace();
      if (!parser.lookAhead(":")) {
        throw new EACompileError("Return type not specified.");
      }
      parser.advance();
      parser.eatWhiteSpace();
      this.returnValue = readParam(parser);
    }
View Full Code Here

   */
  private ParamTemplate readParam(final SimpleParser parser) {
    final ParamTemplate result = new ParamTemplate();

    if (!parser.lookAhead("{")) {
      throw new EACompileError("Expected {");
    }
    parser.advance();

    boolean done = false;
    final StringBuilder buffer = new StringBuilder();

    while (!done) {
      if (parser.peek() == '}') {
        done = true;
        parser.advance();
      } else if (parser.peek() == '{') {
        throw new EACompileError("Unexpected {");
      } else if (parser.peek() == '{') {
        done = true;
        parser.advance();
      } else if (parser.peek() == ',') {
        result.addType(buffer.toString().trim().toLowerCase());
View Full Code Here

   * @return A single numer MLData.
   */
  @Override
  public MLData compute(final MLData input) {
    if (input.size() != getInputCount()) {
      throw new EACompileError("Invalid input count.");
    }

    for (int i = 0; i < input.size(); i++) {
      this.variables.setVariable(i, input.getData(i));
    }
View Full Code Here

    } else if (theType.equals("s")) {
      addType(ValueType.stringType);
    } else if (theType.equals("*")) {
      addAllTypes();
    } else {
      throw new EACompileError("Unknown type: " + theType);
    }
  }
View Full Code Here

      result.append("(");
      result.append(temp.getName());
      result.append(a);
      result.append(")");
    } else {
      throw new EACompileError(
          "An operator must have an arity of 1 or 2, probably should be made a function.");
    }

    return result.toString();
  }
View Full Code Here

    case Variable:
      return handleVar(node);
    case Function:
      return handleFunction(node);
    }
    throw new EACompileError("Uknown node type: " + node.toString());
  }
View Full Code Here

    final String key = EncogOpcodeRegistry.createKey(name, args);
    if (!this.templateMap.containsKey(key)) {
      final ProgramExtensionTemplate temp = EncogOpcodeRegistry.INSTANCE
          .findOpcode(name, args);
      if (temp == null) {
        throw new EACompileError("Unknown extension " + name + " with "
            + args + " arguments.");
      }
      this.opcodes.add(temp);
      this.templateMap.put(key, temp);
    }
View Full Code Here

TOP

Related Classes of org.encog.ml.ea.exception.EACompileError

Copyright © 2018 www.massapicom. 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.