Ағылшыншамен салыстырыңыз: абзацты басыңыз — түпнұсқа терезеде ашылады. Абзац астындағы EN түймесі оны мәтін ішінде көрсетеді.
Мазмұны
Кіріспе
Есептеу күрделілігі теориясында, жалпыланған география — PSPACE-толық проблема.
In computational complexity theory, generalized geography is a well known PSPACE complete problem.
Кіріспе
География – балалар ойыны, онда ойыншылар әлемнің кез келген жеріндегі қалаларды атау кезекпен жүзеге асырылады. Әрбір таңдалған қаланың атауы, алдыңғы қала атын аяқтаған әріппен басталуы тиіс. Атауларды қайталауға болмайды. Ойын кездейсоқ таңдалған қаламен басталады және ойыншы жалғастыра алмай қалғанда аяқталады.
Geography is a children's game, where players take turns naming cities from anywhere in the world. Each city chosen must begin with the same letter that ended the previous city name. Repetition is not allowed. The game begins with an arbitrary starting city and ends when a player loses because he or she is unable to continue.
Графикалық модель
Ойынды көру үшін, түйіндері әлемнің әр қаласы болатын бағытталған граф құруға болады. Егер N2 қаласының атауы N1 қаласының атауының соңғы әрпімен басталатын болса ғана, N1 түйінінен N2 түйініне жебе қосылады. Яғни, егер ойын ережелері бойынша бірінші қала екінші қалаға алып келсе, біз бір қаладан екінші қалаға жебе саламыз. Бағытталған графтың әрбір кезектесетін қабырғасы екі ойыншылық ойын үшін әр ойыншыға сәйкес келеді. Жолды ұзарта алмайтын бірінші ойыншы ұтылады. Ойынның мысалы (Мичиган штатының бірнеше қалаларын қамтиды) төмендегі суретте көрсетілген. Жалпыланған география (GG) ойынында қала аттарының графы кез келген бағытталған графқа ауыстырылады. Төмендегі граф жалпыланған география ойынының мысалы болып табылады.
To visualize the game, a directed graph can be constructed whose nodes are each cities of the world. An arrow is added from node N1 to node N2 if and only if the city labeling N2 starts with the letter that ending the name of the city labeling node N1. In other words, we draw an arrow from one city to another if the first can lead to the second according to the game rules. Each alternate edge in the directed graph corresponds to each player (for a two player game). The first player unable to extend the path loses. An illustration of the game (containing some cities in Michigan) is shown in the figure below. In a generalized geography (GG) game, we replace the graph of city names with an arbitrary directed graph. The following graph is an example of a generalized geography game.
Ойын ойнау
P1-ді бірінші қозғалатын ойыншы, ал P2-ні екінші қозғалатын ойыншы деп анықтаймыз және түйіндерді N1-ден Nn-ге дейін атаймыз. Жоғарыдағы суретте P1 жеңіске жететін стратегиясы былай: N1 тек N2 және N3 түйіндеріне нұсқайды. Осылайша, P1-дің бірінші қозғалысы осы екі таңдаудың бірі болуы тиіс. P1 N2-ні таңдайды (егер P1 N3-ні таңса, онда P2 N9-ды таңдайды, себебі ол жалғыз нұсқа және P1 жеңіледі). Содан кейін P2 N4-ті таңдайды, өйткені ол қалған жалғыз таңдау. P1 енді N5-ті таңдайды, ал P2 кейін N3 немесе N7-ні таңдайды. P2-нің таңдауына қарамастан, P1 N9-ды таңдайды, ал P2-нің таңдауға мүмкіндігі қалмайды және ойынды ұтылады.
We define P1 as the player moving first and P2 as the player moving second and name the nodes N1 to Nn. In the above figure, P1 has a winning strategy as follows: N1 points only to nodes N2 and N3. Thus P1's first move must be one of these two choices. P1 chooses N2 (if P1 chooses N3, then P2 will choose N9 as that is the only option and P1 will lose). Next P2 chooses N4 because it is the only remaining choice. P1 now chooses N5 and P2 subsequently chooses N3 or N7. Regardless of P2's choice, P1 chooses N9 and P2 has no remaining choices and loses the game.
Есептеу күрделілігі
Жалпы географиялық ойында қай ойыншының жеңіс стратегиясы барын анықтау мәселесі PSPACE-толық.
The problem of determining which player has a winning strategy in a generalized geography game is PSPACE complete.
Жалпыланған географиялық PSPACE-қатаң
Келесі дәлелдеу Дэвид Лихтенштейн мен Майкл Сипсерге тиесілі. GG-нің PSPACE қиындығын көрсету үшін біз FORMULA GAME мәселесін (PSPACE қиындығы белгілі) полиномиал уақытта (P) GG-ге келтіре аламыз. Айта кетейік, FORMULA GAME мәселесінің бір мысалы – сандық Буль формуласы φ = ∃x1 ∀x2 ∃x3 … Qxk(ψ), мұнда Q – ∃ немесе ∀. Ойын екі ойыншы, Pa және Pe, кезекпен xi-нің мәндерін таңдайды. Егер ψ формуласы дұрыс болса, Pe жеңеді, ал егер ψ жалған болса, Pa жеңеді. ψ формуласы конъюнктивті нормалық формада деп есептеледі. Бұл дәлелдеуде, қарапайымдық үшін, сандық тізімнің басталуы мен соңы экзистенциалдық квантормен (∃) басталады деп есептейміз. Кез келген өрнекті ψ-де пайда болмайтын фиктивті айнымалыларды қосу арқылы осы формаға келтіруге болады. Жоғарыда көрсетілгендей G графигін құрастыру арқылы FORMULA GAME мәселесінің кез келген мысалын Жалпыланған География мәселесінің мысалына келтіруге болады, онда P1 үшін оңтайлы стратегия Pe стратегиясына, ал P2 үшін оңтайлы стратегия Pa стратегиясына тең. Сол жақ тік тізбектегі түйіндер FORMULA GAME-дегі айнымалылардың мәндерін таңдау процедурасын имитациялауға арналған. Әрбір ромб тәрізді құрылым сандық айнымалыға сәйкес келеді. Ойыншылар әрбір тармақталу нүктесінде кезекпен жолды таңдайды. Бірінші квантор экзистенциалдық деп есептегендіктен, P1 бірінші болып x1 дұрыс болса сол жақ түйінді, ал x1 жалған болса оң жақ түйінді таңдайды. Әр ойыншы міндетті түрде өз кезегін жасағаннан кейін, P2 x2 үшін мәнді таңдайды. Бұл кезектесіп мән беру сол жақта жалғасады. Екі ойыншы да барлық ромбтардан өткеннен кейін, бұл тағы да P1 кезегі, өйткені соңғы квантор экзистенциалдық деп есептедік. P1 графиктің оң жағына қарай жол таңдаудан басқа амалсыз. Содан кейін P2 кезегі келеді. Ойын графиктің оң жағына жеткенде, ол формула ойынының соңына ұқсас. Еске салайық, формула ойынында Pe ψ дұрыс болса жеңеді, ал Pa ψ жалған болса жеңеді. Графиктің оң жағы P1 жеңсе, Pe жеңсе, P2 жеңсе, Pa жеңсе ғана P1 жеңетініне кепілдік береді. Біріншіден, P2 әрқашан Pa жеңгенде жеңетінін көрсетейік. Егер Pa жеңсе, ψ жалған. Егер ψ жалған болса, қанағаттандырмайтын клауза бар. P2 жеңіске жету үшін қанағаттандырмайтын клаузаны таңдайды. Содан кейін P1 кезегі келгенде ол P2 таңдаған клаузадағы литералды таңдауы керек. Клаузадағы барлық литералдар жалған болғандықтан, олар сол жақ тік тізбектегі бұрынғы түйіндерге қосылмайды. Бұл P2 сол тізбектегі ромбтағы сәйкес түйінге байланысты жалғауға және оны таңдауға мүмкіндік береді. Алайда, P1 енді көрші түйіндерді таңдай алмайды және жеңіледі. Енді Pe жеңгенде P1 әрқашан жеңетінін көрсетейік. Егер Pe жеңсе, ψ дұрыс. Егер ψ дұрыс болса, графтың оң жағындағы әрбір клаузада дұрыс литерал болады. P2 кез келген клаузаны таңдай алады. Содан кейін P1 дұрыс литералды таңдайды. Ол дұрыс болғандықтан, оның сол жақ тік тізбектегі көрші түйіні бұрыннан таңдалған, сондықтан P2 амалсыз және жеңіледі.
The following proof is due to David Lichtenstein and Michael Sipser. To establish the PSPACE hardness of GG, we can reduce the FORMULA GAME problem (which is known to be PSPACE hard) to GG in polynomial time (P). In brief, an instance of the FORMULA GAME problem consists of a quantified Boolean formula φ = ∃x1 ∀x2 ∃x3 Qxk(ψ) where Q is either ∃ or ∀. The game is played by two players, Pa and Pe, who alternate choosing values for successive xi. Pe wins the game if the formula ψ ends up true, and Pa wins if ψ ends up false. The formula ψ is assumed to be in conjunctive normal form. In this proof, we assume that the quantifier list starts and ends with the existential qualifier, ∃, for simplicity. Note that any expression can be converted to this form by adding dummy variables that do not appear in ψ. By constructing a graph G like the one shown above, we will show any instance of FORMULA GAME can be reduced to an instance of Generalized Geography, where the optimal strategy for P1 is equivalent to that of Pe, and the optimal strategy for P2 is equivalent to that of Pa. The left vertical chain of nodes is designed to mimic the procedure of choosing values for variables in FORMULA GAME. Each diamond structure corresponds to a quantified variable. Players take turns deciding paths at each branching node. Because we assumed the first quantifier would be existential, P1 goes first, selecting the left node if x1 is true and the right node if x1 is false. Each player must then take forced turns, and then P2 chooses a value for x2. These alternating assignments continue down the left side. After both players pass through all the diamonds, it is again P1 's turn, because we assumed that the last quantifier is existential. P1 has no choice but to follow the path to the right side of the graph. Then it is P2 's turn to make a move. When the play gets to the right side of the graph, it is similar to the end of play in the formula game. Recall that in the formula game, Pe wins if ψ is true, while Pa wins if ψ is false. The right side of the graph guarantees that P1 wins if and only if Pe wins, and that P2 wins if and only if Pa wins. First we show that P2 always wins when Pa wins. If Pa wins, ψ is false. If ψ is false, there exists an unsatisfying clause. P2 will choose an unsatisfying clause to win. Then when it is P1's turn he must choose a literal in that clause chosen by P2. Since all the literals in the clause are false, they do not connect to previously visited nodes in the left vertical chain. This allows P2 to follow the connection to the corresponding node in a diamond of the left chain and select it. However, P1 is now unable to select any adjacent nodes and loses. Now we show that P1 always wins when Pe wins. If Pe wins, ψ is true. If ψ is true, every clause in the right side of the graph contains a true literal. P2 can choose any clause. Then P1 chooses the literal that is true. And because it is true, its adjacent node in the left vertical node has already been selected, so P2 has no moves to make and loses.
Жеткілікті жалпыланған география PSPACE-толық
Жалпыланған география ПСПАС-толық, тіпті жазық графтарда ойналғанда да. Бұл дәлел 3-теоремадан алынған.
Generalized geography is PSPACE complete, even when played on planar graphs. The following proof is from theorem 3 of.
Бағытталмаған география
Сондай-ақ, географиялық ойынды бағытталмаған графтарда ойнау мүмкіндігін қарастыруға болады (яғни, қабырғаларды екі бағытта да жүріп өтуге болады). Френкель, Шейнерман және Ульман бағытталмаған төбелік географияны полиномиалдық уақытта шешуге болатынын көрсетсе, бағытталмаған қабырғалық география PSPACE-толық екенін дәлелдейді, тіпті максималды дәрежесі 3-ке тең жазық графтар үшін де. Егер граф екі бөлікті болса, онда бағытталмаған қабырғалық география полиномиалдық уақытта шешіледі.
One may also consider playing either Geography game on an undirected graph (that is, the edges can be traversed in both directions). Fraenkel, Scheinerman, and Ullman show that undirected vertex geography can be solved in polynomial time, whereas undirected edge geography is PSPACE complete, even for planar graphs with maximum degree 3. If the graph is bipartite, then Undirected Edge Geography is solvable in polynomial time.
Салдарлар
GG PSPACE толық болғандықтан, P = PSPACE болмаса, GG-де ең жақсы ойнау үшін полиномиалдық уақытта жұмыс істейтін алгоритм жоқ. Дегенмен, басқа ойындардың күрделілігін дәлелдеу оңайырақ болмауы мүмкін, себебі кейбір ойындарда (шахмат сияқты) ойын позицияларының саны шектеулі – бұл оларды PSPACE толық проблемасына байланыстыруды қиындатады (немесе мүмкін емес етеді). Бұған қарамастан, кейбір ойындардың күрделілігін жалпылау арқылы талдауға болады (мысалы, n × n тақтаға көшу арқылы). GG толықтығының дәлелінен туындайтын қорытынды ретінде, жалпыланған Го үшін дәлелдерге сілтемелерді қараңыз.
Given that GG is PSPACE complete, no polynomial time algorithm exists for optimal play in GG unless P = PSPACE. However, it may not be as easy to prove the complexity of other games because certain games (such as chess) contain a finite number of game positions — making it hard (or impossible) to formulate a mapping to a PSPACE complete problem. In spite of this, the complexity of certain games can still be analyzed by generalization (e. g., to an n × n board). See the references for a proof for generalized Go, as a corollary of the proof of the completeness of GG.