CS 345: Programming Language Paradigms

CSP and Genetic Algorithms Pseudo-homework

Assigned: September 29

Due: n/a

Note: this is a 'pseudo-homework.' It's some extra questions designed to give you some extra practice working with CSPs and genetic algorithms. You are not required to do this; it's strictly voluntary. However, there will be CSP and GA material on the midterm, so you may find doing this helpful.

If you turn it in to me before Monday October 3, I will look at it and give you feedback. (I will most likely talk about it in the review session as well.)

Note:

As far as the exam goes, I'm interested in finding out whether you understand the basics of how GAs and CSPs work. Focus on the big picture.

Note #2:

If you're feeling overwhelmed, you should start by focusing on studying for the test, then working on the project, then doing the pen-and-paper questions.

  1. Suppose that we are solving the 8-queens problem with a GA, and we have the following solutions:
    1. Give the decimal representation that corresponds to these bitstrings. (i.e. what row is each queen occupying?)
    2. Are either of these valid solutions? Why or why not?
    3. Suppose that we crossover between the 12th and 13th bit. What are the two children?
    4. When solving the N-queens problem, we'll do much better if we take care to only perform crossover between 'row boundaries'; that is, between 3 and 4, 6 and 7, 9 and 10, etc. Why is that?
  2. What is the purpose of mutation? Concisely explain why mutation helps improve the performance of a GA.
  3. What does the Schema Theorem say? I don't expect you to be able to prove it, but you should be able to explain (in words) what it does.
  4. Give a precise formulation for the following problem as a CSP: what are the variables of interest, what are their possible values, and what are the constraints?

    We need to schedule USF's CS classes for next semester. The following classes will be offered: CS I, CS II, Data Structures, Architecture, Senior Project, Software Engineering, Compilers, Distributed Software Development, Operating Systems, Internet Systems Research. Each professor will teach at most two classes. All classes must be taught in Harney 235.

  5. Step through the Bay Area map-coloring problem by hand (with both three and four colors), indicating any backtracking you need to do. Try it with both the least-constraining variable heuristic and a second heuristic we'll call most constraining variable (pick the next county which restricts further choices as much as possible). Which heuristic produces better performance?