当前位置: 首页>>代码示例>>C#>>正文


C# CharSetSolver.MkSetFromRange方法代码示例

本文整理汇总了C#中CharSetSolver.MkSetFromRange方法的典型用法代码示例。如果您正苦于以下问题:C# CharSetSolver.MkSetFromRange方法的具体用法?C# CharSetSolver.MkSetFromRange怎么用?C# CharSetSolver.MkSetFromRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CharSetSolver的用法示例。


在下文中一共展示了CharSetSolver.MkSetFromRange方法的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;
        }
开发者ID:AutomataTutor,项目名称:automatatutor-backend,代码行数:34,代码来源:WS1S.cs

示例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;
        }
开发者ID:AutomataTutor,项目名称:automatatutor-backend,代码行数:30,代码来源:WS1S.cs


注:本文中的CharSetSolver.MkSetFromRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。