示例#1
0
compelem2 = Automate.complementaire(nondeter, "ab")
# compelem2.show("complementaire2")

# Test fonction intersection

auto3 = Automate([
    Transition(s0, 'a', s2),
    Transition(s1, 'a', s1),
    Transition(s0, 'b', s0),
    Transition(s2, 'a', s0),
    Transition(s1, 'b', s2)
])

inter = Automate.intersection(auto1, auto3)
# inter.show("Intersection")

# Test fonction union

inter = Automate.union(auto1, auto3)
# inter.show("union")

# Test fonction concatenation

conca = Automate.concatenation(auto1, auto3)
# conca.show("concatenation")

# Test fonction etoile

etoile = Automate.etoile(auto1)
# etoile.show("etoile")
示例#2
0
print "\n******************************************************\n"

print "********************************************************\n"
print "Test de la méthode union\n"
print "Automate.union(a, b) : \n"
f = Automate.union(a, b)
print f
## Création du pdf
#f.show("UnionAB")
print "\n******************************************************\n"

print "********************************************************\n"
print "Test de la méthode concatenation\n"
print "Automate.concatenation(a, b): \n"
g = Automate.concatenation(a, b)
print g
## Création du pdf
#g.show("ConcatenationAetB")
print "\n******************************************************\n"

print "********************************************************\n"
print "Test de la méthode etoile\n"
print "Automate.etoile(a)\n"
h = Automate.etoile(a)
print h
## Création du pdf
#h.show("EtoileA")
print "\n******************************************************\n"

print "\n\t|Toutes les méthodes ont été testées|\n"
示例#3
0
文件: main.py 项目: UgoMou/Projets
      str(Automate.accepte(uni, "abb")))
#uni.show("union")

print "\n TEST 'concatenation' \n"
conca = Automate.concatenation(autoA, autoB)
print("Le mot aaab est il accepté par l'automate A ? => " +
      str(Automate.accepte(autoA, "aaab")) +
      "\nLe mot abb est il accepté par l'automate B ? => " +
      str(Automate.accepte(autoB, "abb")) +
      "\nLe mots aaab.abb est il accepté par la concatenation A.B ? => " +
      str(Automate.accepte(conca, "aaababb")))
print(autoB)
#conca.show("concatenation")

print "\n TEST 'etoile' \n"
etoi = Automate.etoile(autoA)
print("Le mot vide ε est il accepté par :" + "\n\t-l'automate A ? => " +
      str(Automate.accepte(autoA, "")) + "\n\t-l'etoile A ? => " +
      str(Automate.accepte(etoi, "")) +
      "\nLe mot aaab.aaab est il accepté par :" + "\n\t-l'automate A ? => " +
      str(Automate.accepte(autoA, "aaabaaab")) + "\n\t-l'etoile A ? => " +
      str(Automate.accepte(etoi, "aaabaaab")))
#etoi.show("etoile")
"""
print(auto)
#auto.show("A_ListeTrans")

auto1 = Automate(L,[s0,s1,s2])
print(auto1)
#auto1.show("A_ListeTrans1")
示例#4
0
s2_5 = State(2, False, True)
t1_5 = Transition(s0_5, "a", s0_5)
t2_5 = Transition(s0_5, "b", s0_5)
t3_5 = Transition(s0_5, "a", s1_5)
t4_5 = Transition(s1_5, "b", s2_5)
t5_5 = Transition(s2_5, "a", s2_5)
t6_5 = Transition(s2_5, "b", s2_5)
trans5 = [t1_5, t2_5, t3_5, t4_5, t5_5, t6_5]
auto5 = Automate(trans5, label="auto5")

# cmplt = Automate.completeAutomate(auto1,"ab")
# deter = Automate.determinisation(auto3)
# cmplm = Automate.complementaire(auto1, auto1.getAlphabetFromTransitions())
# inter = Automate.intersection(auto4, auto5)
# union = Automate.union(auto1, auto2)
# conca = Automate.concatenation(auto1, auto2)
etoil = Automate.etoile(auto3)

# auto1.show("auto1")
# auto2.show("auto2")
auto3.show("auto3")
# auto4.show("auto4")
# auto5.show("auto5")
# deter.show("determinisation")
# cmplm.show("complementaire")
# inter.show("intersection")
# union.show("union")
# conca.show("concatenation")
etoil.show("etoile")

print("\n/!\ Automates prets extermination humains /!\\\n")
        print(auto2)
        print(test)
    val = input("Appuyer sur une touche pour test 2 de concatenation")
    test = auto1.concatenation(auto2,auto5)
    if show:
        auto2.show("conc2_auto2")
        auto5.show("conc2_auto5")
        test.show("conc2_concatenation")
    else:
        print(auto2)
        print(auto5)
        print(test)

# fonction etoile

if auto1.etoile(auto1) == None:
    print("etoile non définie")
else:
    val = input("Appuyer sur une touche pour test 1 de etoile")
    test = auto1.etoile(auto5)
    if show:
        auto5.show("e1_auto5")
        test.show("e1_etoile")
    else:
        print(auto5)
        print(test)