๊ทธ๋์ ํ์๋คํ๊ณ ๊ธฐํ ๊ด๋ จ ๋ ผ์ํ๋๊ฑฐ ๋ช๊ฐ ๊ธ์ด์ ๋ด. ๋ด ์ฌ๋๋ค์ ์ด์บ ํ๋์ง ๋ชจ๋ฅด๊ฒ ๋๋ฐ, ๋๋ ์ด๋ ๊ฒ ํ๋ ๋ค๋ฅธ ์ฌ๋๋ค์๊ฒ ์ฐธ๊ณ ๋ ์ง๋ ๋ชจ๋ฅด๊ฒ ๋ค. ์๊น ์๊ธฐํ ๊ฐ๋ ์ฆ๋ช ํ๋ก๊ทธ๋จ๋ ์ ์ฒด๋ ๋ชป ์ฌ๋ฆฌ์ง๋ง ํด๋์ค ํ๋๋ ๊ธ์ด ์ฌ๋ ค๋ด.
...
https://textbin.net/tkuhgqty81
....
In short, communication efficiency can be a generalized way of measuring distance from one central place to a set of other places, where the size of that set is usually far higher than just one. This generalized distance, or to be more precise 'the measure of difficulty and efforts required to get from point A to a set of points B' can be very useful for both political and economical gameplay. However, as I believe it'd require further discussion on the topic, I would refrain from getting into the details other than its abstract role, and immediately go into how it can be used to solve the 'Tile Aggregator' problem.
1. Assume that some method for measuring CE(Communication Efficiency) exists.
2. First, the world has only a set of COT(Center of Trade) and a set of tiles.
3. Each COT is located in a certain tile.
4. Then, use CE measurement to create a set for each COT where that set is a set of all the tiles whose closest COT in terms of CE is that COT.
5. When a new COT gets added, simply create a new set for that new COT out of tiles whose new closest COT in terms of CE is that new COT.
6. When a preexisting COT gets removed, create a temporary list of all neighboring COTs of that removed COT, and for all tiles within that removed COT's set of tiles, check which COT out of that list of neighbors is the closest.
....
One thing that I'm thinking about is how to properly update a graph when one of its node(a tile) is flagged as dirty. I think this algorithm can ensure that your assumption will hold afterwards.
1. There exists a set of dirty tiles.
2. While the dirty tiles set is not empty, find a dirty tile with a lowest distance value. Pop it off from the set.
3. Update its data from its neighbors.
4. If the new distance is equal to its previous distance, continue.
5. If the new distance is lower than its previous distance, find every neighbors whose distance can be improved, update their data, and add them to a temporary set.
5.1. While the temporary set is not empty, find a tile within it with a lowest distance value, pop it off from the dirty tiles set if present in that set, find all of its neighbors whose distance can be improved, update their data, and add them to a temporary set.
6. If the new distance is higher than its previous distance, flag all of its NEXT as dirty, and append them to the set of dirty tiles.ย
ํ๊ธฐ์ฆ๋์ ใ ใ
์ค ๋ฌด์จ ์ฌํ ๋ฌด์ญ ๊ฒ์ ๋ง๋๋๋ด?
์๊ณ ๋ฆฌ์ฆ์ด ๋๋ต ์์์ด ๊ฐ๋๋ฐ ์์ธํ๊ฒ ๋ญ๋ผํ๋์ง ์ ๋ชจ๋ฅด๊ฒ ๋ค
ใดใด ๋์ ๋ต ๊ฒ์์. ๊ฒฝ์ + ์ ์น ์๋ฎฌ๋ ์ด์ ์ด ํต์ฌ์ธ ๊ฒ์์ธ๋ฐ, ์ต๊ทผ ์์ ํ๋๊ฒ ๊ทธ ๋ ๋ชจ๋์์ ์ฌ์ฉ ๋ ์ ์๋ ์ผ์ข ์ ๊ฑฐ๋ฆฌ์ธก์ ์์คํ ์ด์๊ฑฐ๋ . ๋์ A์์ ๋์ B์ฌ์ด์ ๊ฑฐ๋ฆฌ๋ฅผ ๋จ์ํ ์ ํด๋ฆฌ๋์ ์ผ๋ก ๊ณ์ฐํ๋ฉด ๋ ธ์ผ์ด๋ ๊ทธ๋ ๊ฒ ํ๋๊ฑด ๋น์ฐํ ์ ๋๊ณ , ์ข ๋ ์ํธ์์ฉ ๊ฐ๋ฅํ ๋ฐฉ์์ผ๋ก ๊ธฐํ ์ค์ด์์.
๊ทธ๋๋ ์ ๋ถ๋ถ๋ง ๋๊ณ ๋ณด๋ฉด ์ฌํ ๋ฌด์ญ ์๊ฐํ๊ฒ ๋๋ฆ ๋ง๋ ์๊ฐ ๊ฐ๊ธฐ๋ ํ๋ค/
์ ๊ทธ๋ ๊ตฌ๋ ๊ทธ๋ฌ๋ฉด ๋ ์ดํด๊ฐ ๋๋ค ํน์ ์ด ์๊ณ ๋ฆฌ์ฆ์ด ๊ฐ๊น๊ฒ ์ด์๋ ์์ ๊ฐ๊ฐ ๋ง์์๋ก ์์ ์ ํจ์จ์ด ์ฆ๊ฐํ๋ ๊ฑธ ๋ปํ๋๊ฑฐ์ผ?
๊ฒฐ๊ตญ ๊ธธ์ฐพ๊ธฐ ์๊ณ ๋ฆฌ์ฆ์ ์ฌ์ฉํ๋๋ฐ, ํ๋ก๊ทธ๋๋จธ๋ A* ์ฐ์๊ณ ํ๊ฑฐ๋ . ๊ทผ๋ฐ ๊ทธ๊ฑด ๋ ์ง์ ์ฌ์ด์ ์ต์๊ธธ์ด๊ฒฝ๋ก๋ฅผ ํ๋ ์ฐพ๋๋ฐ๋ ๊ทธ๋ญ์ ๋ญ ๊ด์ฐฎ์ ๋ฐ๋ฉด ์ฌ๋ฌ '์์์ '์ผ๋ก๋ถํฐ ์์ฒญ ๋ง์ '๋์ฐฉ์ '๊น์ง์ '๋ชจ๋ ' ์ต์๊ธธ์ด๊ฒฝ๋ก์ ๊ทธ ๊ฒฝ๋ก์ ๊ธธ์ด๋ฅผ ์ฐพ๋๋ฐ๋ ๋ถํ์ํ ์ค๋ฒํค๋๊ฐ ๋ง์. ๊ทธ๋์ ๋๋ ์ฐจ๋ผ๋ฆฌ dijkstra's algorithm ์ ์ฐ์๊ณ ์ ์ํด์ ๋ณด์ฌ์ค๊ฒ ์ ๊ฐ๋ ์ฆ๋ช ํ๋ก๊ทธ๋จ์ด์์. ์ด ์๊ณ ๋ฆฌ์ฆ์ ๋ง์ถฐ์ ๋ฌธ์ ๋ฅผ ์์ ํ๋ฉด ์ด๊ฒ ์์ธ๋ก ๋๊ฒ ํจ์จ์ ์ผ์๊ฐ ์๊ฑฐ๋ . ๊ตฌ๊ด์ด ๋ช ๊ด์ธ ๋ฉด๋ ์์.
์, ๊ทธ๋ฐ๊ฑด ์๋๊ณ , ์ด๋ ๊ฒ ์ค๋ช ํด๋ณผ๊ฒ.
์ ์๊ฐํด๋ณด๋ ๊ธธ๊ฒ ์ค๋ช ํ ๊ฒ ์๋ค. ๊ฑ ๋ ๋์๊ฐ์ ๊ฑฐ๋ฆฌ๊ฐ ๋ฉ์ด์ง์๋ก ๋ฌด์ญ๋ ๋ ์ด๋ ค์์ง๊ณ ๊ทธ๋ฌ๋๋ฐ ์ฐ๋๊ฑฐ์. ๋ฌธ์ ๋ ์ด ๊ฒ์์ ํ์ผ์ด ๋ฐฑ๋ง๊ฐ ์๊ณ , ๊ทธ ์ค ๋ฐ๋ค๊ฐ ์๋๋ผ ๋ ์ธ ํ์ผ์ด 16๋ง๊ฐ๊ณ , ๊ทธ ์ค ๋์์ธ ํ์ผ์ด 1๋ง๊ฐ ์ ๋๋ผ๋ ์ ์ ๋. ๊ทธ๋์ ์์คํ ๊ธฐํ์์ ๊ทนํ์ ํจ์จ์ ์ฅ์ด์ง๋ผ ์ ์๋๋ก ๊ตฌ์ํ๋๊ฒ ๊ฐ์ฅ ํฐ ๊ณ ๋น์์.
๋๋ ์ค๊ฐ์ ๋ผ์ด๋ ๊ฑฐ์ฌ์ ์ด ์ธ๊ณ๊ตฌ ๊ธฐํ๊ณผ ๊ตฌํ์ ์ด๋ฏธ ๋๋ ์๋ ์ํ๋ ๊ทธ๊ฑฐ์ ๋ง์ถฐ์ ๋ด๊ฐ ๋ง๋ค๋ผ๊ณ ์ค์นด์ ๋ ์์คํ ๋ค์ ์งค ์ ๋ฐ์ ์์์.
๋ด ๊ฐ์ธ ์๊ฒฌ์ ๋ฌผ์ด๋ณธ๋ค๋ฉด ๋ฐฑ๋ง๊ฐ๋ ์ข ๋ง์ด ๋์๊ฐ ๊ฒ ๊ฐ๋ค๊ณ ๋งํ ์ ๋ฐ์ ์์ง๋ง, ๋ญ ๋ณ ์ ์๋. ์ด๋ฏธ ๋ง๋ค์ด์ง๊ธฐ๊น์ง ํ๊ฑธ ๋ค ๊ฐ์ ์์ ์๋ ์๋ ๋ ธ๋ฆ์ด๊ณ .
๋๋ฌด ๋ง๋ค๋ฉด ์ ์ฒด๋งต์ ๋ ธ๋๋ฅผ ํฉ์ณ ํฌ๊ฒ ๋ง๋ค๊ณ ์ ๋ ์ฃผ์ ๊ทธ๋ฆฌ๋๋ง ์ ๊ฒ ๋ง๋ค์ด ์ฒ๋ฆฌํ์ง
ใ ใ ๊ทธ๋ฐ ๋ฐฉํฅ์ผ๋ก ๊ธฐํ์ ์ก๊ธด ํ์.
๊ทผ๋ฐ ๋ค์ต์คํธ๋ผ๋ฅผ ์ถ์ฒํ๋ ๊ฑฐ ๋ณด๋ฉด ๋ง๋ ๊ฒ์์ด ๋ญ ๋ฐฉํด๋ฌผ์ด ์๋? ๋ฐฉํด๋ฌผ์ด ์์ผ๋ฉด ์์ด์คํ๊ฐ ๋์ํ ๋ฐ
๊ฑ ๋ ธ๋์ ๋ ธ๋ ์ฌ์ด์ ๊ฑฐ๋ฆฌ๋ง ์๋ ํํ๋ก ๋ง๋ค๋ฉด ์๊ด์์๋ฏ
์จ๋ฐ๋ จ์ ์์์ด์ฐ๋๋ฐ