Homework #2. (Practicing Genetic Algorithm) Homework (Project #1) description. Implement a genetic algorithm to solve the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Homework #2. (Practicing Genetic Algorithm) Homework (Project #1) description. Implement a genetic algorithm to solve the following problem: Consider filling a MxN rectangle with the numbers 1...MN in some random order. For example: Cost = 1 2 5 9 3 4 6 7 8 10 11 12 14 15 16 13 |1-2|+|2-3|+|3-4|+|5-6|+|6-7|+|7-8|+|9-10|+|10-11|+|11-12|| + |1-5|+|2-6|+|3-7|+|4-8|+|5-9|+|6-10|+|7-11|+|8-12| Each number has either 4 neighbors or 3 neighbors (on the edge) or 2 neighbors (in a corner). The total cost is the sum of the absolute differences between all neighboring pairs of numbers. If you come up with a fancy alternative to the genetic algorithm, you may request to implement that as an alternative to solve the same problem. To construct the initial population of completed states, you can initialize the rectangle however you want. For example, you might generate completely random initial states, use a specific ordering of the numbers, or use some other algorithm to create the initial states. Your program will accept the M and N values on the command line where N follows M, e.g., java Genetic Algorithm 2 5, where M-2 and N-5. Your program can output the solution to a test file (solution_1.txt, solution_2.txt, ...), and the total cost both to the standard output (screen) to a text file (solution_cost.txt). However, it will be given more credits if the ouputs are visualized graphically on the screen. <Testing your algorithm> Please test your genetic algorithm on the problems listed below. You should report: 1. One text file (solution cost.txt) should contain the total cost for each of the given problems. (one line for each) 2. For each of the problems output your solution to a separate file (solution 1.txt, solution 2.txt, etc.). Each of the files should contain only your solution (no other text), in other words it should have N columns and M rows. Try your genetic algorithm on the following problems. If your algorithm cannot solve or takes too long to solve a particular problem, please state that in your solution cost.txt file. If your algorithm takes too long to solve a problem, you may terminate or wait as long as you choose for it to complete. You are required to solve only problems 1 and 2, but we encourage you to try all of them. If your algorithm can solve the bigger problems, you will get extra credits. 1. N-4, M-5 2. N-7 M-13 3. N-37 M-35 4. N-75 M-100 5. N-490 M-730 A text file with your solution should contain just the data. In other words, it should have M rows separated by a new line character ( \n) and each one of the N columns should be separated by a comma. You can use the following programming languages: Java. We will compile (if necessary) and run your code, therefore, make sure you are not using any non-standard libraries Your algorithm has to run on Windows 10. Submit all of your code and a report. In a report, describe what algorithm you have implemented and how to run your code. The report is required to be in a pdf format. Homework #2. (Practicing Genetic Algorithm) Homework (Project #1) description. Implement a genetic algorithm to solve the following problem: Consider filling a MxN rectangle with the numbers 1...MN in some random order. For example: Cost = 1 2 5 9 3 4 6 7 8 10 11 12 14 15 16 13 |1-2|+|2-3|+|3-4|+|5-6|+|6-7|+|7-8|+|9-10|+|10-11|+|11-12|| + |1-5|+|2-6|+|3-7|+|4-8|+|5-9|+|6-10|+|7-11|+|8-12| Each number has either 4 neighbors or 3 neighbors (on the edge) or 2 neighbors (in a corner). The total cost is the sum of the absolute differences between all neighboring pairs of numbers. If you come up with a fancy alternative to the genetic algorithm, you may request to implement that as an alternative to solve the same problem. To construct the initial population of completed states, you can initialize the rectangle however you want. For example, you might generate completely random initial states, use a specific ordering of the numbers, or use some other algorithm to create the initial states. Your program will accept the M and N values on the command line where N follows M, e.g., java Genetic Algorithm 2 5, where M-2 and N-5. Your program can output the solution to a test file (solution_1.txt, solution_2.txt, ...), and the total cost both to the standard output (screen) to a text file (solution_cost.txt). However, it will be given more credits if the ouputs are visualized graphically on the screen. <Testing your algorithm> Please test your genetic algorithm on the problems listed below. You should report: 1. One text file (solution cost.txt) should contain the total cost for each of the given problems. (one line for each) 2. For each of the problems output your solution to a separate file (solution 1.txt, solution 2.txt, etc.). Each of the files should contain only your solution (no other text), in other words it should have N columns and M rows. Try your genetic algorithm on the following problems. If your algorithm cannot solve or takes too long to solve a particular problem, please state that in your solution cost.txt file. If your algorithm takes too long to solve a problem, you may terminate or wait as long as you choose for it to complete. You are required to solve only problems 1 and 2, but we encourage you to try all of them. If your algorithm can solve the bigger problems, you will get extra credits. 1. N-4, M-5 2. N-7 M-13 3. N-37 M-35 4. N-75 M-100 5. N-490 M-730 A text file with your solution should contain just the data. In other words, it should have M rows separated by a new line character ( \n) and each one of the N columns should be separated by a comma. You can use the following programming languages: Java. We will compile (if necessary) and run your code, therefore, make sure you are not using any non-standard libraries Your algorithm has to run on Windows 10. Submit all of your code and a report. In a report, describe what algorithm you have implemented and how to run your code. The report is required to be in a pdf format.
Expert Answer:
Answer rating: 100% (QA)
This seems like an interesting challenge Designing a genetic algorithm to solve this problem require... View the full answer
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date:
Students also viewed these programming questions
-
A researcher wanted to find out if there was difference between older movie goers and younger movie goers with respect to their estimates of a successful actors income. The researcher first...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Give the analysis report of Superstar Solar, Inc regarding the following requirements. Analysis of Superstar Solar, Inc.s Cost Classifications Analyze and provide examples in detail of the following...
-
Elite Electronics signed a 10-year, 6.5%, $350,000 mortgage on June 30, 2011, to help finance a new research laboratory. The mortgage terms provide for semi-annual blended principal and interest...
-
In Exercises 1318, find the limit (if it exists) and discuss the continuity of the function. In z lim (x, y, z) (-3, 1, 2) xyz
-
Robert Shapiro was the owner and CEO of Woodbridge, a supposed investment firm. Woodbridges main business model was to solicit money from individuals to invest in low-risk and conservative...
-
Green Golf Accessories sells golf shoes, gloves, and a laser-guided range-finder that measures distance. Shown below are unit cost and sales data. Fixed costs are $620,000. Instructions (a) Compute...
-
Instructions: Place the six steps of the accounting cycle in the correct order. Rank the options below. Prepare financial statements.Prepare financial statements. open choices for ranking No answer...
-
Please respond to the following: Examine the steps necessary to complete a sale and discuss how the sales order process is integrated with other processes (credit and collections, delivery, etc.)....
-
8 Corporation Fruit issues a Section 1244 stock to shareholders in exchange for property. Prior to the exchange, the property's adjusted basis is $100 and FMV is $75. On the date of the exchange, the...
-
How do socialization agents serve as conduits for the transmission of cultural norms and values within societal structures?
-
Given the hot real estate market in Tucson, Lucy and Ricky decided to sell their home this year for $ 7 6 0 , 0 0 0 . They originally purchased the home for $ 2 0 0 , 0 0 0 . Lucy and Ricky owned and...
-
What is the Financial Services Guide? Discuss some services in the Guide for official sex procedure.
-
Impact on Taxes. James has a marginal tax rate of 12%. He suddenly realizes that he neglected to include a $7,500 tax deduction. How will this oversight affect his taxes? From question A, if James...
-
Two perfectly positively correlated securities are combined into a portfolio. One security is expected to return 10% with a volatility of 20% and the other is expected to return 15% with a volatility...
-
Aztec Furnishings makes hand-crafted furniture for sale in its retail stores. The furniture maker has recently installed a new assembly process, including a new sander and polisher. With this new...
-
a. In how many ways can two sorted arrays of N elements be merged? b. Give a nontrivial lower bound on the number of comparisons required to merge two sorted lists of N elements, by taking the...
-
Suppose that the maze may or may not have a solution. a. Describe a linear-time algorithm that determines the minimum number of walls that need to be knocked down to create a solution. b. Describe an...
-
Show that quickselect with median-of-median-of-seven partitioning is linear. Why is median-of-median-of-seven partitioning not used in the proof?
-
Let \(X, Y, X_{n}, Y_{n}: \Omega ightarrow \mathbb{R}, n \geqslant 1\), be random variables. a) If, for all n > 1, Xn Yn and if (Xn, Yn) (X, Y), then XIL Y. b) Let X Y such that X, Y ~ B1/2 = (80...
-
Let \(X_{n}, Y_{n}: \Omega ightarrow \mathbb{R}, n \geqslant 1\), be two sequences of random variables. a) If \(X_{n} \xrightarrow{d} X\) and \(Y_{n} \xrightarrow{\mathbb{P}} c\), then \(X_{n} Y_{n}...
-
Let \(X_{n}, Y_{n}: \Omega ightarrow \mathbb{R}^{d}, n \geqslant 1\), be two sequences of random variables such that \(X_{n} \xrightarrow{d} X\) and \(X_{n}-Y_{n} \xrightarrow{\mathbb{P}} 0\). Then...
Study smarter with the SolutionInn App