/// <summary> /// </summary> /// <param name="before"></param> /// <param name="after"></param> public VRiscuitRule(IBeforePattern before, IAfterPattern after, ScoreCoefficient sce, bool isDebug = false) { BeforePattern = before; AfterPattern = after; _coefficient = sce; _beforeObjectSet = BeforePattern.VRiscuitObjects; _afterObjectSet = AfterPattern.ResultObjectSet; _genDelTable = new Dictionary <string, int>(_afterObjectSet.DistributionTable); IsDebug = isDebug; foreach (var kvp in _beforeObjectSet.DistributionTable) { if (_genDelTable.ContainsKey(kvp.Key)) { _genDelTable[kvp.Key] -= kvp.Value; } else { _genDelTable.Add(kvp.Key, -kvp.Value); } if (_genDelTable[kvp.Key] != 0) { isGenerateOrDeleteObject = true; } } // alphaの値をルールの動き量で決める var afterParam = new VRiscuitObjectSet(_afterObjectSet).ToParameters(); var beforeSet = new VRiscuitObjectSet(_beforeObjectSet); GenerateOrDeleteObject(beforeSet, null); var beforeParam = beforeSet.ToParameters(); _paramLength = TwoArrayDistance(afterParam, beforeParam); }
public VRiscuitRule(IBeforePattern before, IAfterPattern after, bool isDebug = false) : this(before, after, new ScoreCoefficient(), isDebug) { }