ﻧﻅﺭﻳﺔ ﺍﻟﺗﻌﻘﻳﺩ 30/3/2014 4 ﺍﻟﺟﻠﺳﺔ DTime(T(n)) is a set of all computable function (algorithm) in at most c.T(n) ,where c > 0. DTime(T(n2)) is a set of all computable function (algorithm) in at most O(n2). If T1(n)=O(T2(n)) ; T2(n) > T1(n) ⟹ DTime(T1(n)) ⊆ DTime(T2(n)) ⟹ DTime(n) ⊆ DTime(n2) Proved that DTime(n) ⊆ DTime(n2) ? Proof : n2= O(n)..\\ just this!! Or: for DTime(n) there is a Turing machine that computed a function in (c.n) steps. DTime(n2) : the same but in (c.n2 ) steps. Now if we use c.n steps to compute the function, we still have n steps for nothing (because it's c.n2); ⟹ any machine could compute (c.n2) it can do it for (c.n). :ﺻﻑ ﺍﻟﺗﻌﻘﻳﺩ !؟. ﺃﻭ ﻻ ﺗﻧﺗﻣﻲp ﻫﻝ ﺗﻧﺗﻣﻲ ﺍﻟﻣﺳﺄﻟﺔ ﺇﻟﻰ: ﺑﺎﻟﻧﺳﺑﺔ ﻟﻠﺳﺅﺍﻝ ﺑﺈﻣﻛﺎﻧﻧﺎ ﺃﻥ ﻧﻘﺩﻡ ﺧﻭﺍﺭﺯﻣﻳﺔ ﻟﺣﺳﺎﺏ ﺍﻟﺗﺎﺑﻊ ﺑﺯﻣﻥ ﻓﻌﺎﻝ ﺃﻭ ﺍﻻﺧﺗﺻﺎﺭ ﺇﻟﻰ ﻣﺳﺄﻟﺔ .ﻣﻌﺭﻭﻓﺔ :SAT ﻣﺳﺄﻟﺔ ﺍﻟـ : ﻟﺩﻳﻧﺎ ﺑﺷﻛﻝ ﻋﺎﻡ ﻣﺟﻣﻭﻋﺔ ﻣﺗﺣﻭﻻﺕ ﻣﻧﻁﻘﻳﺔ X1,X2…………..Xn : ﻣﻥ ﺍﺣﺩ ﺍﻷﺷﻛﺎﻝ ﺍﻟﺗﺎﻟﻳﺔf ﻭﺗﺎﺑﻊ F= X1∨ X2 ∧ X1 ∨ X3…… ﻧﻅﺭﻳﺔ ﺍﻟﺗﻌﻘﻳﺩ 30/3/2014 4 ﺍﻟﺟﻠﺳﺔ ؟..true ﻳﻛﻭﻥf ﻫﻝ ﻳﻭﺟﺩ ﻗﻳﻡ ﻟﻠﻣﺗﺣﻭﻻﺕ ﺑﺣﻳﺙ:ﺍﻟﻣﺳﺄﻟﺔ .SAT in general ﺇﻧﻬﺎ ﻣﺳﺄﻟﺔ : ﻳﺄﺧﺫ ﺍﻟﺷﻛﻝCNF SAT ﻫﻧﺎﻙ ﻧﻭﻉ ﻣﻧﻬﺎ F= C1 ∧ C2 ∧ C3….. C : clause , consists of literal ex: Ci = (l1 ∨ l2 ∨…..) , and li is a Xi or Xi . Note that between clauses there's (∧) , and between literals we had (∨) . :ﻣﺛﺎﻝ (X3 ∨ X5) ∧ (X3 ∨ X1 ∨ X4) ∧ (X2 ∨ X3 ∨ X5) m : num of clauses = 3 n : num of variables = 5 X1 = 1, X4 = 1 ,X2 = 1, X3 =0, X5=0 2 SAT means 2 CNF SAT ; in each clause we have 2 literals at most. It is ok if we have one attachment , we put it with itself by or (∨) . :P ﻫﻲ ﻣﺳﺄﻟﺔ2 SAT ﻟﺑﺭﻫﺎﻥ ﺃﻥ ﻣﺳﺄﻟﺔ : ﻭﺳﻳﻛﻭﻥ ﻟﺩﻳﻧﺎ ﺍﻟﺣﺎﻻﺕ ﺍﻟﺗﺎﻟﻳﺔ:ﻧﻌﻁﻲ ﻷﺣﺩ ﺍﻟﻣﺗﺣﻭﻻﺕ ﻗﻳﻣﺔ Xi not set && Xj not set Xi =1 && Xj not set Xi =0 && Xj not set Xi =0 && Xj =0 2 ﻧﻅﺭﻳﺔ ﺍﻟﺗﻌﻘﻳﺩ 30/3/2014 Xi =1 && Xj=0 4 ﺍﻟﺟﻠﺳﺔ 5 . ﻷﻥ ﺍﻟﺣﺎﻟﺔ ﺗﻧﺎﻅﺭﻳﺔ ﺑﻳﻧﻬﻣﺎXi ، Xj ﻟﻳﺱ ﻫﻧﺎﻙ ﻓﺭﻕ ﻓﻲ ﺣﺎﻝ ﻋﻛﺳﻧﺎ ﺍﻟﺣﺎﻟﺔ ﺑﻳﻥ ﻧﺣﺻﻝ ﻋﻠﻰ5 ، 2 ﺇﺫﺍ ﺣﺫﻓﻧﺎ ﻣﻥ ﺍﻟﺣﺎﻻﺕ ﺍﻟﺳﺎﺑﻘﺔ. ﻳﻣﺛﻝ ﻣﺎ ﺳﺑﻕf ﺍﻵﻥ ﺍﻟﺗﺎﺑﻊ .true ﺳﻳﻛﻭﻥ ﺣﻛﻣﺎf ﻫﺫﺍ ﻳﻌﻧﻲ ﺃﻥtrue ﻣﺣﻘﻕ ﺃﻭf` ﻭﺍﻓﺗﺭﺿﻧﺎ ﺃﻥf` ﺍﻟﺗﺎﺑﻊ .NOT SAT f ﻓﻠﻳﺱ ﺑﺎﻟﺿﺭﻭﺭﺓ ﺃﻥ ﻳﻛﻭﻥNOT SAT ﺃﻭfalse f` ﺃﻣﺎ ﺇﺫﺍ ﻛﺎﻥ X1 =1 ﻟﻧﻔﺭﺽ: ﻋﻠﻰ ﺍﻟﻣﺛﺎﻝ ﺍﻟﺳﺎﺑﻕ C1 → 2 X C2 → 1 C3 → 2 X F` = ( X2 ∨ X3) Again X2 =1 ⇒ f`` = (X2 ∨ X3 ) : X2 has 1 before and now X3 : if X3 = 0 that's ok and f`` =1 , else if it's 1 then f`` = 0 and we will move to 4th state. ⟹ X1 =1, X2 =1, X3 =0 . Another example: f= (X1 ∨ X2) ∧ (X2 ∨ X3) ∧ (X1 ∨ X2) X1 =0 : C1 → 3 , C2 → 1 , C3 → 2 We avoid the 3rd clause. F``= (X1 ∨ X2) ∧ (X2 ∨ X3) Now X2 =0 : C1 → 5 , C2 → 3 We avoid the 1st clause. F``` = (X2 ∨ X3) X3 =1 ⇒ f``` = 1 ⇒ F is SAT , X3 = 0 ⇒ f``` = 0 we move to 4th state . ﻧﻅﺭﻳﺔ ﺍﻟﺗﻌﻘﻳﺩ ﺍﻟﺟﻠﺳﺔ 4 30/3/2014 ﻣﻣﺎ ﺳﺑﻕ ﻧﺟﺩ ﺃﻥ ﻣﺳﺄﻟﺔ SATﻫﻲ ﻣﺳﺄﻟﺔ .P ﺗﻌﻘﻳﺩ ﺍﻟﺧﻭﺍﺭﺯﻣﻳﺔ: ﺃﺳﻭﺃ ﺣﺎﻟﺔ :ﺍﻟﺗﺟﺭﺑﺔ 2n ﻓﻲ ﺃﻭﻝ ﻣﺭﺓ ﻳﺣﺫﻑ clauseﻭﺍﺣﺩ ﻭﻛﺫﻟﻙ ﻓﻲ ﺍﻟﻣﺭﺓ ﺍﻟﺛﺎﻧﻳﺔ ﻭﺍﺣﺩ ﻭﻫﻛﺫﺍ..... )m(m+1 2 = m + m-1 +m-2 +….. O(nm2) ∈ P. 2 coloring graph: )G(V ,E ﻣﻥ ﺃﺟﻝ ﻛﻝ ﻋﻘﺩﺗﻳﻥ ﻧﺿﻳﻑ ﺍﻟﺗﺎﺑﻊ : ﺃﺳﻭﺩ )For each c(Vi ,Vj) ∈ E; c(Vi) ≠ c(Vj ﺃﺳﻭﺩ )F= (Vi ∨ Vj) ∧ (Vi ∨ Vj ﺃﺳﻭﺩ ﺃﺣﻣﺭ ﺑﻣﻌﻧﻰ ﺃﻧﻪ ﻻ ﻳﻣﻛﻥ ﺃﻥ ﻳﻛﻭﻥ ﻓﻲ ﻁﺭﻓﻲ ﺍﻟﻭﺻﻠﺔ ﺍﻟﻠﻭﻥ ﻧﻔﺳﻪ. Complexity : O(|E|) ..// length of the graph.
© Copyright 2024