/* (non-Javadoc)
   * @see com.epochx.core.scorer.SemanticScorer#doScore(com.epochx.representation.CandidateProgram, com.epochx.representation.CandidateProgram)
   */
  public double doScore(GPCandidateProgram program1, GPCandidateProgram program2) {
    double score;

    // TODO figure out a better way of doing this
    if (super.getSemanticModule() instanceof BooleanSemanticModule) {
      ((BooleanSemanticModule) super.getSemanticModule()).start();
    }

    BooleanRepresentation program1Representation =
        (BooleanRepresentation) getSemanticModule().codeToBehaviour(program1);
    BooleanRepresentation program2Representation =
        (BooleanRepresentation) getSemanticModule().codeToBehaviour(program2);
    BDD rep1 = program1Representation.getBDD();
    BDD rep2 = program2Representation.getBDD();
    BDD diffRep1 = rep1.and(rep2.not());
    BDD diffRep2 = rep2.and(rep1.not());
    BDD finalDiff = diffRep1.or(diffRep2);
    score = finalDiff.satCount() * 100;

    // TODO figure out a better way of doing this
    if (super.getSemanticModule() instanceof BooleanSemanticModule) {
      ((BooleanSemanticModule) super.getSemanticModule()).stop();
    }

    return score;
  }
Example #2
0
 /* (non-Javadoc)
  * @see net.sf.javabdd.BDDFactory#nithVar(int)
  */
 public BDD nithVar(int var) {
   BDD b = ithVar(var);
   BDD c = b.not();
   b.free();
   return c;
 }