See attached: [url removed, login to view] (for specification), [url removed, login to view] (for arrays to input) and [url removed, login to view] (for vb starting code)
VB Excel Project, Input a problem, produce a solution, Arrays/Userforms *$200*
Write a program that attempts to solve the &acirc;€œpartial Latin square problem&acirc;€ using simple optimization techniques. Specifically your program will allow the user to input a problem, and will produce a solution using a descent method, and possibly other more sophisticated methods. The program should not allow the user to edit the spreadsheet directly. Instead, all user interaction should be carried out via UserForms and/or input boxes and message boxes.
Latin squares are n &Atilde;— n arrays filled with n different symbols, each occurring once per row and once per column. Here is an example using n = 5.
3 5 1 4 2
5 4 3 2 1
1 2 4 5 3
4 3 2 1 5
2 1 5 3 4
Write a program that reads-in a specified problem file. Program should then produce an initial solution to this problem in a randomized fashion, such that (a) the givens appear in their correct positions in the grid, and (b) all rows contain the values 1,&acirc;€&brvbar;,n exactly once, as explained above. If a problem contains no givens, then your program should be able to detect this and can simply return the &acirc;€œroot solution&acirc;€ to the user. The root solution is simply a grid that has values (1, 2,&acirc;€&brvbar;, n) on the first row, (2, 3,&acirc;€&brvbar;, n, 1) on the second row, (3, 4,&acirc;€&brvbar;, n, 1, 2) on the third row, and so on. For example, here are the root solutions for n = 3 and n = 5
Assuming that your initial solution is not yet a Latin square, a cost function should now be written that calculates its quality according to the descriptions.
Next task is to write code that attempts to improve on the initial solution. To start, this is to be achieved using a random descent technique. This should operate by making a random alteration (move) to the solution and then re-evaluating. If the cost is lowered or stays the same, then we accept the changes, otherwise the change should be reset. This process is then repeated.
Modify the code so that when an initial solution is first produced the user has a choice of using the descent method or simulated annealing. Hence write the code for carrying out the simulated annealing. You may wish to use a UserForm to allow the user to define the various choices and control parameters.
If you have successfully completed Tasks 1-3, then try improving your program by making it more efficient, powerful and/or user-friendly. Extras to include:
Using UserForms to allow the user to specify input files, algorithm choice, algorithm parameters, etc.
Allowing your program to collect information on each run (e.g. initial cost, final cost, the changes in cost according to the number of evaluations, etc.) and then store this in a worksheet. You might also choose to include graphs that allow you to view the changes in cost that were achieved according to the number of evaluations.
Modifying your algorithm to see if further improvements might be made. For example, you could:
Make your solution evaluations more efficient by only recalculating the cost of the columns that were altered during a move;
Use different types of neighborhood operators, cooling schedules etc.
Attempt to introduce some heuristics into the algorithm e.g. clever methods for producing high-quality initial solutions, clever methods for making changes to a solution.