3. To‘rt o‘zgaruvchili Karno kartalari
To‘rt o‘zgaruvchili Karno kartalarida ikki va uch o’zgaruvchili Karno kartalaridagi usullar qo‘llaniladi. Faqatgina to‘rt o‘zgaruvchili Karno kartalarida birinchi va to‘r tinchi ustunlar, birinchi va to‘rtinchi qatorlar bir-biriga qo‘shni hisoblanadi, chunki ular mos ravishda vertikal yoki gorizontal silindrlarga o‘ralsa, ushbu ustunlar yoki qatorlar bir-biriga qo‘shni bo‘lib qoladi. To‘rt o‘zgaruvchili Karno kartalarining to‘rtta burchagi ham bir-biriga qo‘shni hisoblanadi, chunki karta “sferaga” o‘ralsa, to‘rtta burchak bir-biriga qo‘shniga aylanadi.
Masalan; F(0,0,0,1)=F(0,0,1,1)=F(1,0,0,1)=F(1,0,1,1)=0
Karno kartasi bo‘yicha formulaning soddalashgan ko‘rinishi quyidagicha bo‘ladi: F(A,B,C)= BD
Quyida keltirilgan misollar uchun Karno kartalari tuzilsin, soddalashtirilsin, soddalashgan formulaga mos rele-kontakt sxemasi chizilsin:
5.1
|
F(0,0,0)=F(0,1,1)=F(1,1,0)=F(1,0,0)=1
|
5.2
|
F(0,0,0)=F(0,1,0)=F(1,1,0)=F(1,0,0)=1
|
5.3
|
F(0,0,1)=F(0,1,1)=F(1,1,1)=F(1,0,1)=1
|
5.4
|
F(0,0,1)=F(0,1,0)=F(1,1,0)=F(1,0,1)=1
|
5.5
|
F(0,0,0)=F(0,1,0)=F(1,1,1)=F(1,0,1)=1
|
5.6
|
F(0,0,0)=F(0,0,1)=F(1,0,0)=F(1,0,1)=1
|
5.7
|
F(0,1,0)=F(0,1,1)=F(1,1,0)=F(1,1,1)=1
|
5.8
|
F(0,0,0)=F(0,0,1)=F(0,1,0)=F(0,1,1)=1
|
5.9
|
F(0,0,0)=F(0,0,1)=F(1,1,0)=F(1,1,1)=1
|
5.10
|
F(1,1,0)=F(1,1,1)=F(1,0,0)=F(1,0,1)=1
|
5.11
|
F(0,1,0)=F(0,1,1)=F(1,0,0)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,0,0,0)=F(1,0,1,0)=0
|
5.30
|
F(0,0,0,1)=F(0,0,1,1)=F(1,0,0,1)=F(1,0,1,1)=0
|
2.4. Yechimlar daraxti
Dasturlashda xotirani va vaqtni tejash nuqtai nazaridan funksiyalar yoki formulalarni (ifodalarni) grafik ko‘rinishda “tabiiy” ifodalash (massivlarda) bilan to‘g‘ridan-to‘g‘ri bog‘liqlikka ega bo‘lmagan, lekin amallarni bajarishga maxsus yo‘naltirilgan ko‘rinishda ifodalash samaraliroq hisoblanadi. N o‘zgaruvchili Bul funksiyasi rostlik jadvalini n+1 balandlikdagi to‘liq binary daraxt ko‘rinishida ifodalash mumkin. Daraxt yaruslari (qavatlari) o‘zgaruvchilarga mos keladi, daraxt shoxlari esa o‘zgaruvlar qiymatlariga mos keladi. Chap shoxga – 0, o‘ng shoxga esa – 1 qiymat mos qo‘yiladi. Daraxt yaproqlari – oxirgi yarusda esa daraxt ildizidan shu yaproqgacha bo‘lgan yo‘lga mos kortejdagi funksiya qiymatlari mos qo‘yiladi. Bunday daraxt yechimlar daraxti yoki semantik daraxt deyiladi.
Buni quyidagicha misolda ko‘rib chiqamiz. F(A,B,C) funksiya quyidagicha rostlik jadvali bilan berilgan bo‘lsin:
1)Yechimlar daraxtini ayrim hollarda barcha barglarni bir xil qiymatga ega bo‘lgan daraxt ostilarini, shu qiymat bilan almashtirilsa yechimlar daraxti hajmining sezilarli darajada ixchamlashtiradi.
Agar bog‘liqliklarning daraxt ko‘rinishidan voz kechilsa, yechimlar daraxtini anchagina kompaktlashtirish mumkin. Quyidagicha uchta ketma-ket shakl almashtirishlardan so‘ng binary yechimlar daraxtidan binar yechimlar diagrammasi hosil bo‘ladi:
1. 0 va 1 qiymatlarni qabul qilgan yaproqlar birlashtiriladi. Natijada daraxt quyidagi ko‘rinishni oladi:
D iagrammada izomorf (o‘xshash) diagramma ostilari birlashtiriladi:
3. Ikkala chiquvchi shoxi ham bitta joyga boradigan tugunlar ahamiyatsiz o‘zgaruvchi sifatida tushirib qoldiriladi va bu tugunga kiruvchi shox chiquvchi shoxlar boradigan tugunlargacha davom ettiriladi.
Natijada F(A,B,C) funksiya qiymatlarini yechimlarning binar diagrammasi orqali berish mumkin:
|