Class RuleSetConstraints
- All Implemented Interfaces:
Clique,Setup,Serializable
First the initialization parameters. You need to specify a distribution from which the system will pick random integer values X. When a ruleset is to be initialized, a random value X is picked from this distribution, and the ruleset will be created with X initial rules. You can specify the distribution in one of two ways. First, you can specify a minimum and maximum number of rules; the system will then pick an X uniformly from between the min and the max. Second, you can specify a full distribution of size probabilities for more control. For example, to specify that the system should make individuals with 0 rules 0.1 of the time, 1 rule 0.2 of the time, and 2 rules 0.7 of the time, you set reset-num-sizes to 3 (for rule sizes up to but not including 3), and then set reset-size.0 to 0.1, reset-size.1 to 0.2, and reset-size.2 to 0.7.
Next the mutation parameters. The default mutation procedure works as follows. First, every rule in the ruleset is mutated. It is up to the rule to determine by how much or whether it will be mutated (perhaps by flipping a coin) when its mutate function is called. Second, the system repeatedly flips a coin with "p-del" probability of being true, until it comes up false. The number of times it came up true is the number of rules to remove from the ruleset; rules to be removed are chosen at random. Third, the system repeatedly flips a coin with "p-add" probability of being true, until it comes up false. The number of times it came up true is the number of new randomly-generated rules to add to the ruleset; rules are added to the end of the array. Fourth, with "p-rand-order" probability, the order of rules in the ruleset array is randomized; this last item might or might not matter to you depending on whether or not your rule interpreter differs depending on rule order.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionbyteThe byte value of the constraints -- we can only have 256 of themintintThe name of the RuleSetConstraints objectdoublestatic final Stringdoublestatic final Stringstatic final Stringstatic final Stringstatic final StringThe size of a bytestatic final Stringstatic final Stringdoublestatic final Stringstatic final Stringstatic final Stringstatic final Stringnum rulesetsintintThe prototype of the Rule that will be used in the RuleSet (the RuleSet contains only rules with the specified prototype).double[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RuleSetConstraintsconstraintsFor(String constraintsName, EvolutionState state) You must guarantee that after calling constraintsFor(...) one or several times, you call state.output.exitIfErrors() once.intnumRulesForReset(RuleSet ruleset, EvolutionState state, int thread) Returns a stochastic value picked to specify the number of rules to generate when calling reset() on this kind of Rule.intpickSize(EvolutionState state, int thread) Assuming that either resetMinSize and resetMaxSize, or sizeDistribution, is defined, picks a random size from resetMinSize...resetMaxSize inclusive, or randomly from sizeDistribution.voidsetup(EvolutionState state, Parameter base) Sets up the object by reading it from the parameters stored in state, built off of the parameter base base.toString()Converting the rule to a string ( the name )
-
Field Details
-
P_NAME
The size of a byte- See Also:
-
P_RULE
num rulesets- See Also:
-
P_RESETMINSIZE
- See Also:
-
P_RESETMAXSIZE
- See Also:
-
P_NUMSIZES
- See Also:
-
P_RESETSIZE
- See Also:
-
P_MINSIZE
- See Also:
-
P_MAXSIZE
- See Also:
-
minSize
public int minSize -
maxSize
public int maxSize -
resetMinSize
public int resetMinSize -
resetMaxSize
public int resetMaxSize -
sizeDistribution
public double[] sizeDistribution -
P_ADD_PROB
- See Also:
-
p_add
public double p_add -
P_DEL_PROB
- See Also:
-
p_del
public double p_del -
P_RAND_ORDER_PROB
- See Also:
-
p_randorder
public double p_randorder -
rulePrototype
The prototype of the Rule that will be used in the RuleSet (the RuleSet contains only rules with the specified prototype). -
constraintNumber
public byte constraintNumberThe byte value of the constraints -- we can only have 256 of them -
name
The name of the RuleSetConstraints object
-
-
Constructor Details
-
RuleSetConstraints
public RuleSetConstraints()
-
-
Method Details
-
pickSize
Assuming that either resetMinSize and resetMaxSize, or sizeDistribution, is defined, picks a random size from resetMinSize...resetMaxSize inclusive, or randomly from sizeDistribution. -
numRulesForReset
Returns a stochastic value picked to specify the number of rules to generate when calling reset() on this kind of Rule. The default version picks from the min/max or distribution, but you can override this to do whatever kind of thing you like here. -
toString
Converting the rule to a string ( the name ) -
constraintsFor
You must guarantee that after calling constraintsFor(...) one or several times, you call state.output.exitIfErrors() once. -
setup
Description copied from interface:SetupSets up the object by reading it from the parameters stored in state, built off of the parameter base base. If an ancestor implements this method, be sure to call super.setup(state,base); before you do anything else.
-