/// <summary> /// Produces a random path of labels from the initial state to some final state. /// Assumes that the automaton is nonempty and does not contain deadends. /// </summary> /// <param name="chooser">uses the chooser for randomizing the choices</param> public IEnumerable <S> ChoosePathToSomeFinalState(Chooser chooser) { if (IsEmpty) { throw new AutomataException(AutomataExceptionKind.AutomatonMustBeNonempty); } int state = InitialState; while (!IsFinalState(state) || (OutDegree(state) > 0 && chooser.ChooseTrueOrFalse())) { if (!IsFinalState(state) && OutDegree(state) == 0) { throw new AutomataException(AutomataExceptionKind.AutomatonMustNotContainDeadStates); } var move = GetNthMoveFrom(state, chooser.Choose(GetMovesCountFrom(state))); if (!move.IsEpsilon) { yield return(move.Label); } state = move.TargetState; } yield break; }
///// <summary> ///// Equivalent (identical) ///// </summary> //public static bool operator ==(BV128 x, BV128 y) //{ // return x.Item1 == y.Item1 && x.Item2 == y.Item2; //} ///// <summary> ///// Inequivalent (different) ///// </summary> //public static bool operator !=(BV128 x, BV128 y) //{ // return x.Item1 != y.Item1 || x.Item2 != y.Item2; //} /// <summary> /// Generates a random bitvector. /// </summary> public static BV128 Random() { var c = new Chooser(); var u1 = c.ChooseBV64(); var u2 = c.ChooseBV64(); return(new BV128(u1, u2)); }
public RegexToAutomatonConverterHashSet(HashSetSolver solver) : base(solver, new UnicodeCategoryToHashSetProvider(solver)) { this.solver = solver; this.chooser = new Chooser(); }
public RegexToAutomatonConverterRanges(CharRangeSolver solver) : base(solver, new UnicodeCategoryToRangesProvider(solver)) { this.solver = solver; this.chooser = new Chooser(); }
public RegexToAutomatonConverterCharSet(CharSetSolver solver) : base(solver, new UnicodeCategoryToCharSetProvider(solver)) { this.bddBuilder = solver; this.chooser = new Chooser(); }