org.encog.ml.ea.rules
Class BasicRuleHolder
- java.lang.Object
-
- org.encog.ml.ea.rules.BasicRuleHolder
-
- All Implemented Interfaces:
- java.io.Serializable, RuleHolder
public class BasicRuleHolder extends java.lang.Object implements RuleHolder
Basic implementation of a rule holder.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description BasicRuleHolder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddConstraintRule(ConstraintRule rule)Add a constraint rule.voidaddRewriteRule(RewriteRule rule)Add a rewrite rule.java.util.List<ConstraintRule>getConstraintRules()java.util.List<RewriteRule>getRewriteRules()booleanisValid(Genome genome)Determine if the specified genome is valid according to the constraint rules.voidrewrite(Genome prg)Rewrite the specified genome.
-
-
-
Method Detail
-
addRewriteRule
public void addRewriteRule(RewriteRule rule)
Add a rewrite rule. Rewrite rules can be used to simplify genomes.- Specified by:
addRewriteRulein interfaceRuleHolder- 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:
rewritein interfaceRuleHolder- Parameters:
prg- The genome to rewrite.
-
addConstraintRule
public void addConstraintRule(ConstraintRule rule)
Add a constraint rule.- Specified by:
addConstraintRulein interfaceRuleHolder- 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:
isValidin interfaceRuleHolder- Parameters:
genome- The gnome to check.- Returns:
- True, if the genome is valid.
-
getConstraintRules
public java.util.List<ConstraintRule> getConstraintRules()
- Specified by:
getConstraintRulesin interfaceRuleHolder- Returns:
- The list of constraints.
-
getRewriteRules
public java.util.List<RewriteRule> getRewriteRules()
- Specified by:
getRewriteRulesin interfaceRuleHolder- Returns:
- The rewrite rules.
-
-
DMelt 3.0 © DataMelt by jWork.ORG