![]() The MSF library is essentially no longer being actively developed, but the current 3.1 version works fine for me. MSF originally came in two versions, a free Express Edition and a for-purchase enterprise edition, but the enterprise edition has been discontinued. The installation wizard tells you you’re installing the Express Edition. I prefer to use 32-bit libraries when experimenting so I clicked on that link, which gave me the option to run or save the MicrosoftSolverFoundation.msi installation package. The location of the download has tended to move around over time but I found it at bit.ly/1vayGh1. The MSF version 3.1 library is available as a separate code download. All normal error checking has been removed to keep the main ideas clear. All the code is presented here and it is also available in the code download that accompanies this article at /magazine/msdnmag0814. The demo program is coded using C# but you should be able to refactor the demo to other. This article assumes you have at least intermediate-level programming skills and a vague idea of what Sudoku puzzles are, but does not assume you know anything about constraint satisfaction problems or the MSF library. The demo concludes by displaying the solution.įigure 1 Sudoku Using the Microsoft Solver Foundation Then, behind the scenes, the demo uses the MSF library to solve the puzzle. Next, it programmatically defines constraints (required conditions) that are common to all Sudoku puzzles, and then sets up the data constraints that are specific to the puzzle. The demo console application begins by setting up and displaying the data for a typical Sudoku puzzle. To get an idea of where this article is headed, take a look at the demo program in Figure 1. And third, you might just find that solving Sudoku puzzles programmatically is interesting and entertaining. ![]() Second, this article will introduce you to the MSF library and its capabilities. First, the techniques presented here can be used to solve many realistic problems. Although it’s highly unlikely you’ll ever need to solve a Sudoku puzzle as part of your normal work responsibilities, there are at least three reasons why you might want to read this article. ![]() One way to tackle CSPs programmatically is to use the Microsoft Solver Foundation (MSF) library. Volume 29 Number 8 Test Run : Solving Sudoku Puzzles Using the MSF LibraryĪ Sudoku puzzle is an example of what’s called a constraint satisfaction problem (CSP).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |