本文整理汇总了C#中CharSetSolver.MkSetWithBitTrue方法的典型用法代码示例。如果您正苦于以下问题:C# CharSetSolver.MkSetWithBitTrue方法的具体用法?C# CharSetSolver.MkSetWithBitTrue怎么用?C# CharSetSolver.MkSetWithBitTrue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CharSetSolver
的用法示例。
在下文中一共展示了CharSetSolver.MkSetWithBitTrue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: computeDFA
internal static Automaton<BDD> computeDFA(List<string> variables, BDD alphabet, CharSetSolver solver, string set1, string set2)
{
int pos1 = variables.IndexOf(set1);
int pos2 = variables.IndexOf(set2);
Dictionary<int, Dictionary<Pair<int, int>, Automaton<BDD>>> dic1;
if (!hashedDfa.ContainsKey(alphabet))
hashedDfa[alphabet] = new Dictionary<int, Dictionary<Pair<int, int>, Automaton<BDD>>>();
dic1 = hashedDfa[alphabet];
Dictionary<Pair<int, int>, Automaton<BDD>> dic2;
if (!dic1.ContainsKey(variables.Count))
dic1[variables.Count] = new Dictionary<Pair<int, int>, Automaton<BDD>>();
dic2 = dic1[variables.Count];
var hash = new Pair<int, int>(pos1, pos2);
if (dic2.ContainsKey(hash))
return dic2[hash];
//Create conditions that bit in pos1 is smaller than pos2
var trueBv = solver.MkSetFromRange(0, (uint)(Math.Pow(2, variables.Count + 16) - 1), variables.Count + 16 - 1);
var both1 = solver.MkAnd(new BDD[] { trueBv, solver.MkSetWithBitTrue(pos1), solver.MkSetWithBitTrue(pos2) });
var both0 = solver.MkAnd(new BDD[] { trueBv, solver.MkSetWithBitFalse(pos1), solver.MkSetWithBitFalse(pos2) });
var eqCond = solver.MkOr(new BDD[] { both0, both1 });
//Create automaton for condition
var moves = new Move<BDD>[] { new Move<BDD>(0, 0, eqCond) };
var dfa = Automaton<BDD>.Create(0, new int[] { 0 }, moves).Determinize(solver).Minimize(solver);
if(hashing)
dic2[hash] = dfa;
return dfa;
}
示例2: getDFA
internal override Automaton<BDD> getDFA(List<string> variables, BDD alphabet, CharSetSolver solver)
{
int varbit = variables.IndexOf(var1);
Dictionary<Pair<int, int>, Automaton<BDD>> dic;
if (!hashedDfa.ContainsKey(alphabet))
hashedDfa[alphabet] = new Dictionary<Pair<int, int>, Automaton<BDD>>();
dic = hashedDfa[alphabet];
var hash = new Pair<int, int>(variables.Count, varbit);
if (dic.ContainsKey(hash))
return dic[hash];
//Create conditions
var trueBv = solver.MkSetFromRange(0, (uint)(Math.Pow(2, variables.Count + 7) - 1), variables.Count + 7 - 1);
var posis1 = solver.MkAnd(trueBv, solver.MkSetWithBitTrue(varbit));
var posis0 = solver.MkAnd(trueBv, solver.MkSetWithBitFalse(varbit));
//Create automaton for condition
var moves = new Move<BDD>[] {
new Move<BDD>(0, 1, posis1),
new Move<BDD>(1, 1, posis0)
};
var dfa = Automaton<BDD>.Create(0, new int[] { 1 }, moves).Determinize(solver).Minimize(solver);
dic[hash] = dfa;
return dfa;
}