本文整理汇总了C#中Automaton.Minus方法的典型用法代码示例。如果您正苦于以下问题:C# Automaton.Minus方法的具体用法?C# Automaton.Minus怎么用?C# Automaton.Minus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Automaton
的用法示例。
在下文中一共展示了Automaton.Minus方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDFADifferenceRatio
/// <summary>
/// Computes the ratio of the symmetric difference to the size of dfa1 enumerating paths up to length n (uses the complement if density is high)
/// </summary>
/// <returns>size of ((dfa2-dfa1)+(dfa1-dfa2))/dfa1</returns>
public static double GetDFADifferenceRatio(Automaton<BDD> dfa1, Automaton<BDD> dfa2, HashSet<char> al, CharSetSolver solver)
{
var solutionDensity = DFADensity.GetDFADensity(dfa1, al, solver);
//Symmetric difference
var dfadiff1 = dfa1.Minus(dfa2, solver);
var dfadiff2 = dfa2.Minus(dfa1, solver);
var dfatrue = Automaton<BDD>.Create(0, new int[] { 0 }, new Move<BDD>[] { new Move<BDD>(0, 0, solver.True) });
var dfadiff = dfatrue.Minus(dfatrue.Minus(dfadiff1, solver).Intersect(dfatrue.Minus(dfadiff2, solver), solver), solver).Determinize(solver).Minimize(solver);
//Use smallest of |dfa1| and complement of |dfa1| for cardinality base
return GetDFARatio(dfa1.Determinize(solver).Minimize(solver), dfadiff, al, solver, solutionDensity > 0.5);
}
示例2: DFAEDFeedback
public DFAEDFeedback(Automaton<BDD> dfaGoal, Automaton<BDD> dfaAttempt, FeedbackLevel level, HashSet<char> alphabet, DFAEditScript script, double utility, CharSetSolver solver)
: base(level, alphabet, utility, solver)
{
var positiveDifference = dfaGoal.Minus(dfaAttempt, solver).Determinize(solver).Minimize(solver);
var negativeDifference = dfaAttempt.Minus(dfaGoal, solver).Determinize(solver).Minimize(solver);
this.counterexample = DFAUtilities.GenerateShortTerm(positiveDifference.IsEmpty ? negativeDifference : positiveDifference, solver);
this.type = FeedbackType.DFAED;
this.script = script;
}
示例3: DensityFeedback
public DensityFeedback(FeedbackLevel level, HashSet<char> alphabet, Automaton<BDD> dfaGoal, Automaton<BDD> dfaAttempt, double utility, CharSetSolver solver)
: base(level, alphabet, utility,solver)
{
BDD pred = solver.False;
foreach (var el in alphabet)
pred=solver.MkOr(pred,solver.MkCharConstraint(false,el));
var dfaAll = Automaton<BDD>.Create(0,new int[]{0},new Move<BDD>[]{new Move<BDD>(0,0,pred)});
this.type = FeedbackType.Density;
this.positiveDifference = dfaGoal.Minus(dfaAttempt, solver).Determinize(solver).Minimize(solver);
this.negativeDifference = dfaAttempt.Minus(dfaGoal, solver).Determinize(solver).Minimize(solver);
this.symmetricDifference = dfaAll.Minus(dfaAll.Minus(positiveDifference,solver).Intersect(dfaAll.Minus(negativeDifference,solver),solver),solver).Determinize(solver).Minimize(solver);
this.solver = solver;
}
示例4: L
/*
IsYieldTypeSafe :
2.1 Input parameters :
2.1.1 Automaton<BvSet> implTypeCheckAutomaton : This input Automaton is generated for a phase of YTS checking of an impl.
2.2 Return value : returns true if input automaton is subset of YTS property autoamaton.
2.3 Action : Subset checking for a phase of an implementation. f L(YTSI) is subset of L(YTSP) {TRUE} else {FALSE}
*/
public static bool IsYieldTypeSafe(Automaton<BvSet> implTypeCheckAutomaton, Implementation impl, MoverTypeChecker moverTypeChecker, int phaseNum)
{
List<BvSet> witnessSet;
var isNonEmpty = Automaton<BvSet>.CheckDifference(
implTypeCheckAutomaton,
yieldTypeCheckerAutomaton,
0,
yieldTypeCheckerAutomatonSolver,
out witnessSet);
#if DEBUG && !DEBUG_DETAIL
var diffAutomaton = implTypeCheckAutomaton.Minus(yieldTypeCheckerAutomaton, yieldTypeCheckerAutomatonSolver);
string diffAutomatonGraphName = "diffAutomaton" + impl.Proc.Name + phaseNum.ToString();
yieldTypeCheckerAutomatonSolver.ShowGraph(diffAutomaton, diffAutomatonGraphName+".dgml");
#endif
#if DEBUG && !DEBUG_DETAIL
string s = yieldTypeCheckerAutomatonSolver.GenerateMember(implTypeCheckAutomaton);
Console.WriteLine("\n member " + s+ " \n");
if(!yieldTypeCheckerAutomatonSolver.Accepts(yieldTypeCheckerAutomaton,s)){
Console.WriteLine("Property Automaton accepts a random member of impl_automaton " + s);
}else{
Console.WriteLine("Property Automaton does not accept a random member of impl_automaton " + s);
}
#endif
if (isNonEmpty)
{
var witness = new String(Array.ConvertAll(witnessSet.ToArray(), bvset => (char)yieldTypeCheckerAutomatonSolver.Choose(bvset)));
moverTypeChecker.Error(impl, "\n Body of " + impl.Proc.Name + " has invalid trace of actions " + witness + "\n");
return false;
}
return true;
}
示例5: NFAEDFeedback
public NFAEDFeedback(Automaton<BDD> nfaGoal, Automaton<BDD> nfaAttempt,
FeedbackLevel level, HashSet<char> alphabet,
NFAEditScript script, CharSetSolver solver)
: base(level, alphabet, solver)
{
//TODO might have to determinize to do this operations
var positiveDifference = nfaGoal.Minus(nfaAttempt, solver).Determinize(solver).Minimize(solver);
var negativeDifference = nfaAttempt.Minus(nfaGoal, solver).Determinize(solver).Minimize(solver);
this.counterexample = DFAUtilities.GenerateShortTerm(positiveDifference.IsEmpty ? negativeDifference : positiveDifference, solver);
this.script = script;
}
示例6: NFACounterexampleFeedback
// automata come already determinized
public NFACounterexampleFeedback(
FeedbackLevel level, HashSet<char> alphabet,
Automaton<BDD> solutionDFA, Automaton<BDD> attemptDFA,
CharSetSolver solver)
: base(level, alphabet, solver)
{
BDD pred = solver.False;
foreach (var el in alphabet)
pred = solver.MkOr(pred, solver.MkCharConstraint(false, el));
var dfaAll = Automaton<BDD>.Create(0, new int[] { 0 }, new Move<BDD>[] { new Move<BDD>(0, 0, pred) });
this.positiveDifference = solutionDFA.Minus(attemptDFA, solver).Determinize(solver).Minimize(solver);
this.negativeDifference = attemptDFA.Minus(solutionDFA, solver).Determinize(solver).Minimize(solver);
this.solver = solver;
}