org.encog.ml.ea.rules
Class BasicRuleHolder

java.lang.Object
  extended by org.encog.ml.ea.rules.BasicRuleHolder
All Implemented Interfaces:
RuleHolder

public class BasicRuleHolder
extends Object
implements RuleHolder

Basic implementation of a rule holder.


Constructor Summary
BasicRuleHolder()
           
 
Method Summary
 void addConstraintRule(ConstraintRule rule)
          Add a constraint rule.
 void addRewriteRule(RewriteRule rule)
          Add a rewrite rule.
 List<ConstraintRule> getConstraintRules()
          
 List<RewriteRule> getRewriteRules()
          
 boolean isValid(Genome genome)
          Determine if the specified genome is valid according to the constraint rules.
 void rewrite(Genome prg)
          Rewrite the specified genome.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicRuleHolder

public BasicRuleHolder()
Method Detail

addRewriteRule

public void addRewriteRule(RewriteRule rule)
Add a rewrite rule. Rewrite rules can be used to simplify genomes.

Specified by:
addRewriteRule in interface RuleHolder
Parameters:
rule - The rule to add.

rewrite

public void rewrite(Genome prg)
Rewrite the specified genome. The genome will still perform the same function, but it may be shorter.

Specified by:
rewrite in interface RuleHolder
Parameters:
prg - The genome to rewrite.

addConstraintRule

public void addConstraintRule(ConstraintRule rule)
Add a constraint rule.

Specified by:
addConstraintRule in interface RuleHolder
Parameters:
rule - The rule to add.

isValid

public boolean isValid(Genome genome)
Determine if the specified genome is valid according to the constraint rules.

Specified by:
isValid in interface RuleHolder
Parameters:
genome - The gnome to check.
Returns:
True, if the genome is valid.

getConstraintRules

public List<ConstraintRule> getConstraintRules()

Specified by:
getConstraintRules in interface RuleHolder
Returns:
The list of constraints.

getRewriteRules

public List<RewriteRule> getRewriteRules()

Specified by:
getRewriteRules in interface RuleHolder
Returns:
The rewrite rules.


Copyright © 2014. All Rights Reserved.