Ask Computer Engineering Expert

Assignment: Search

This assignment will require you to explore a variety of search techniques on two problems.

Part 1 - Heavy N-queens problem

The problem -

For this problem, you will work on a variant of the N-queens problem we discussed in class. The queen pieces are very heavy, and therefore difficult to move. The cost to move a queen is 10 plus the square of the number of tiles you move it. So to move a queen upwards 4 squares in a column costs 10 + 42 = 26. Otherwise, the rules are identical to the N-queens problem.

Approaches

You will use two approaches for this problem: A* and greedy hill climbing with restarts. For A*, you need a heuristic function. The number of (directly and indirectly) attacking queens is a good place to start. Since moving a queen costs 10 points, you can modify the heuristic to be:

1. If no attacking queens: 0

2. If attacking queens: 10 + # of pairs of attacked queens

Note: it is not immediately clear if this heuristic is admissible. Moving one queen can reduce the cost dramatically (as we talked about in class). However, given the fixed cost of 10 to move a queen, perhaps no situation arises where the true cost is less than the heuristic value. For extra credit, prove either that the heuristic is admissible or produce a counterexample to demonstrate that it is not.

For hill climbing with restarts, you should use the same heuristic function as for A* and perform greedy hill climbing. If you have not found a solution, and fewer than 10 seconds have elapsed since the program started running, you should do another iteration of hill climbing with a random start state.

Program behavior -

Your program should take as input the N value for the N-queens problem and the type of search to conduct (1 for A*, 2 for greedy hill climbing). For example, passing in a "30" results in a 30-queens puzzle. You can take input as command-line input, or read it from a file if command-line input is difficult for the language you are using. Just explain how in your writeup.

Your program should output:

The start state (a simple text representation is fine)

The number of nodes expanded. Consider an expansion as when you visit a node and compute the cost for all of the possible next moves. For hill climbing, remember to count this value across all of the restarts!

Time to solve the puzzle

The effective branching factor: consider how many nodes were expanded vs. the length of the solution path

The cost to solve the puzzle. Note that A* computes cost automatically, but you will but tneed to extend greedy search to keep track of this number. Note that cost does not include any failed runs with greedy search -- just compute the cost of the path it computes for the board it solves. (Note the comparison with A* is not quite fair since greedy search gets to discard its results from tougher boards)

The sequence of moves needed to solve the puzzle, if any (hill climbing may fail).

Write-up -

You should conduct experiments to determine:

1. How large of a puzzle can your program typically solve within 10 seconds using A*? Using greedy hill climbing?

2. What is the effective branching factor of each approach? For this computation, perform 10 runs of a puzzle half the maximum size you calculated for step #1.

3. Which approach comes up with cheaper solution paths? Why?

4. Which approach typically takes less time?

Part 2 - Urban planning

The problem -

For this problem, you will use hill climbing and genetic algorithms to determine the ideal location of industry, commerce, and residential sections a city. You will input a map with the following symbols:

  • X: former toxic waste site. Industrial zones within 2 tiles take a penalty of -10. Commercial and residential zones within 2 tiles take a penalty of -20. You cannot build directly on a toxic waste site.
  • S: scenic view. Residential zones within 2 tiles gain a bonus of 10 points. If you wish, you can build on a scenic site but it destroys the view.
  • 0...9: how difficult it is to build on that square. You will receive a penalty of that many points to put anything on that square.

You will have to place industrial, residential, and commercial tiles on the terrain.

  • Industrial tiles benefit from being near other industry. For each industrial tile within 2, there is a bonus of 3 points.
  • Commercial sites benefit from being near residential tiles. For each residential tile within 3 squares, there is a bonus of 5 points. However, commercial sites do not like competition. For each commercial site with 2 squares, there is a penalty of 5 points.
  • Residential sites do not like being near industrial sites. For each industrial site within 3 squares there is a penalty of 5 points. However, for each commercial site with 3 squares there is a bonus of 5 points.

Note that all distances uses the Manhattan distance approach. So distance is computed in terms of moves left/right and up/down, not diagonal movement.

Approaches -

You will use hill climbing with restarts and genetic algorithms for this assignment. When your hill climbing restarts, it may not ?modify the map! It can only change where it initially places the different zones to begin the hill climbing process.

Your genetic algorithms will have to come up with a representation, selection and crossover methods, and must make use of culling, elitism, and mutation.

Program behavior -

Your program will read in a file where the first 3 lines are the number of industrial, commercial, and residential locations (respectively). The remainder of the file is a rectangular map of the terrain to place the town. Your program should then run for approximately 10 seconds and output the following to a file:

  • The score for this map
  • At what time that score was first achieved.
  • The map, with the various industrial, commercial, and residential sites marked.

Write-up -

You should analyze your program's behavior to answer the following questions:

1. Explain how your genetic algorithm works. You must describe your selection, crossover, elitism, culling, and mutation approaches.

2. Create a graph of program performance vs. time. Run your program 10 times and plot how well hill climbing and genetic algorithms perform after 0.1, 0.25, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10 seconds. If you only had 0.25 seconds to make a decision, which technique would you use? Does your answer change if you have 10 seconds?

3. How do elitism and culling affect performance?

4. How did you perform selection and crossover for your population? Find some known method for doing selection, other than the one described in class. Explain what you did.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92689197

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As