"Gobang AI" multithreading-multi-threaded PVS

Source: Internet
Author: User

For multi-threaded search This aspect, I do not have much knowledge, and MTDF algorithm in my program performance than PVS, especially the last layer (not previously searched) is likely to get stuck, very annoying. So we can only use multi-threaded PVS, multi-threaded PVS need to separate a root node search function on the basis of the original search function. At the root node, the entire tree is chopped to a number of CPU cores, and then the search is performed and the results are summarized. Although it is possible to specify the core of the thread to run, I do not do it, mostly used. NET Unlike more than 10 years ago with VB6 then willing to touch the API, and then put some work to the system do nothing bad, just entertainment, there is no need to get other programs around or hide into the corner.

Multi-threaded search needs to pay attention to the problem is thread synchronization, in fact, my code does not have much synchronization code, only need to put parameters, search functions, threads, notification events encapsulated in the class, so that each search is independent, their intersection is only the substitution table, the substitution table with a read and write lock-write multiple read, A few simple lines of code are available. Finally, the search class is initialized at the root node, looping the thread, waiting for the end, and counting the search results. Of course, this does not dynamically allocate thread efficiency, but the code is simple, improve 30% search efficiency or some, in the complex situation if the system is idle, that basically can improve the CPU core several times efficiency.


These are the introductions here. In a few days, maybe one day, maybe January. See if you can find bugs and new ideas after you have quickly discovered the VCT/VCF feature. If none of them go into a lot of test phases, when the test is done there is no new idea that the software will be over.




All articles and source collation completed, later updates will also be at the following address:

http://www.vbdevelopers.org

http://www.softos.org

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.