private static void buildDissolutionVariables(KPsystem kpSystem, KpCore.MType type, NuSMV.Module module, int strategyIndex, KpCore.Rule rule) { //Preserve variable value and update status value. DissolutionRule dissolutionRule = (DissolutionRule)rule; foreach (var leftHRule in dissolutionRule.Lhs) { Variable variable = new Variable(leftHRule.Key); if (!module.Variables.Contains(variable)) { variable.Type = new BoundInt(0, setMax(kpSystem, type, module, variable)); variable.Behaviour = VariableBehaviour.REWRITING; variable.Init = setOrUpdateInit(module, variable); module.Variables.Add(variable); } else { //if variable exists then update the upperbound value. variable = (Variable)module.Variables.First(item => item.Name.Equals(leftHRule.Key)); } //add result of rule to caseline BRulesStandardVar.addCaseLineToStandardVariable(variable, rule, module, strategyIndex); } // add rule to status variable BRulesCustomVar.addRuleToStatusVariable(rule, module, strategyIndex); }
private static void buildDivisionVariables(NuSMV.Module module, KPsystem kpSystem, KpCore.MType type, int strategyIndex, KpCore.Rule rule) { DivisionRule divisionRule = (DivisionRule)rule; foreach (var leftHRule in divisionRule.Lhs) { Variable variable = new Variable(leftHRule.Key); if (!module.Variables.Contains(variable)) { variable.Type = new BoundInt(0, setMax(kpSystem, type, module, variable)); variable.Behaviour = VariableBehaviour.REWRITING; variable.Init = setOrUpdateInit(module, variable); module.Variables.Add(variable); } else { //if variable exists then update the upperbound value. variable = (Variable)module.Variables.First(item => item.Name.Equals(leftHRule.Key)); } //add result of rule to caseline BRulesStandardVar.addCaseLineToStandardVariable(variable, rule, module, strategyIndex); } foreach (InstanceBlueprint compartment in divisionRule.Rhs) { MType compType = compartment.Type; if (type.Name.Equals(compType.Name)) { Multiset ms = compartment.Multiset; foreach (var obj in ms.Objects) { Variable variable = new Variable(obj); if (!module.Variables.Contains(variable)) { variable.Type = new BoundInt(0, setMax(kpSystem, compType, module, variable)); variable.Behaviour = VariableBehaviour.DIVISION; variable.Init = setOrUpdateInit(module, variable); module.Variables.Add(variable); } else { variable = (Variable)module.Variables.First(item => item.Name.Equals(obj)); variable.Behaviour = VariableBehaviour.DIVISION; } } } } // add rule to status variable BRulesCustomVar.addRuleToStatusVariable(rule, module, strategyIndex); }