Lecture 3 - Search Flashcards

1
Q

General pattern for solving Sudoku?

A

1) select a square (→ Heuristics)
2) check all possibilities (→ Constraint Satisfaction)
3) propagate the information to other squares (write all possible numbers in all squares) (→ Constraint Propagation)
4) repeat these steps until the solution is complete (→ Search)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Steps in a search process?

A

1) Heuristics
2) Constraint Satisfaction
3) Constraint Propagation
4) Search

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What do you need for defining a search problem?

A

1) A state description
(an abstract representation of the current state of a puzzle)

2) A goal function
(checks whether a state description satisfies the goal)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a “state description”?

A
  • An abstract representation of the current state of a puzzle
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the set of all “state descriptions” called?

A

State Space

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a “goal function”?

A
  • checks whether a state description satisfies the goal
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Explain the two steps in Simple Exhaustive Search?

A

1) Generate all possible states
2) Test the goal function for each state

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Explain the approach when performing Local Search (it is similar to solving a puzzle by hand)

A
  • keep a single “current state”
  • try to improve it by maximizing a heuristic evaluation
  • using only “local” improvements aka “actions”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain the advantages and disadvantages with “local search”?

A

Advantages
- memory efficient
- fast in infinite state spaces

Disadvantages
- solution not always found aka no guarantees for
- does not ensure optimality (that the best/shortest solution is found)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

State Representation
The image is an example of a state representation from mutilated chess board problem. Choosing a good state representation may be crucial for finding a good solution. How could a better state representation look?

A

-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is this problem called and what is the challenge?

A

Mutilated Chess Board problem: Can you cover a mutilated chess board with dominoes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What constitutes the states in a 8-puzzle?

A
  • The location of the tiles
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

8-puzzle actions
What computational actions in a 8-puzzle could not be done in the physical world?

A
  • move blank tile (left, right, up, down)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Why is it better to simulate that the blank field moved when trying to solve a 8-puzzle?

A

Easier than having separate moves for each tile.
Ignore actions like unjamming slides if they get stuck

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Why is the complete-state formulation in the 8-queens problem inefficient?

A
  • There are to many states (any configuration of 8 queens on the board)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

States in the 8-queens problem?

A

any configuration of 8 queens on the board

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Actions in the 8-queens problem?

A
  • Move one of the queens to another square
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Explain the 8-queens problem

A

The eight queens puzzle isthe problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row, column, or diagonal. There are 92 solutions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is meant by heuristics in search algorithms?

A
  • function that estimates the quality of a given state
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Example of heuristics in way finding?

A

straight-line distances may be a good approximation for the true distances on a map

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Basic idea of Heuristics in the n-queens problem

A

Move a queen so that it reduces the number of conflicts → heuristic h is # of queen pairs that attack each other.

Almost always solves n-queens problems almost instantaneously for very large n (e.g. n = 1 000 000)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How do simple search algorithms like hill-climbing search aka greedy local search work?

A

algorithm:

The hill climbing search algorithm does the following:

  • expand the current state (generate all neighbors)
  • move to the one with the highest evaluation
  • until the evaluation goes down
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is the main problem with hill-climbing search?

A

Main Problem: Local Optima
- the algorithm will stop as soon as it is at the top of a hill
but it is actually looking for a mountain peak (global uptimum vs many local optima)

Other problems
- ridges
- plateaux
- shoulders

24
Q

Explain the state space landscape and the related assumptions

A

state-space landscape

  • location: states
  • elevation: heuristic value (objective function)

Assumption:
- states have some sort of (linear) order continuity regarding small state changes

25
Q

Explain a multidimensional state landscape

A

States may be refined in multiple ways
→ similarity along various dimensions

26
Q

Using gradient decent what kind of optimum will you find (global or local)?

A

Most likely you will find a local optimum.

27
Q

Explain Random Restart Hill-Climbing

A

Different initial positions result in different local optima → make several iterations with different starting positions

28
Q

Explain stochastic Hill-Climbing

A
  • select the successor node randomly
  • better nodes have a higher probability of being selected
29
Q

Explain Beam Search

A
  • Keep track of k states rather than just one
    k is called the beam size
  • Algorithm
    Start with k randomly generated states
    At each iteration, all the successors of all k states are generated
    select the k best successors from the complete list and repeat
30
Q

Explain simulated annealing search

A

Simulated annealing is an optimization technique inspired by the cooling process of metals. It searches for an optimal solution by exploring both good and bad moves, gradually reducing the likelihood of accepting worse solutions as it “cools.” This approach helps avoid local optima by balancing exploration (higher chance of worse moves initially) and exploitation (focusing on better solutions as the temperature lowers).

31
Q

Explain Genetic Algorithms

A

Genetic algorithms are optimization methods inspired by natural selection.

They evolve solutions over generations by combining, mutating, and selecting the fittest individuals from a “population” of solutions. Through crossover and mutation, they explore new solutions, while selection retains the best ones, gradually improving toward an optimal solution.

32
Q

Explain “Mutation” in relation to the “Genetic Algorithm”

A

Modelled after mutation of DNA. Take one parent string. Modify a random value.

33
Q

Explain cross-over in relation to the Genetic Algorithm

A

Modelled after cross-over of DNA. Take two parent strings, cut them a cross-over point, recombine the pieces. It is helpful if the substrings are meaningful subconcepts.

34
Q

List the steps in a Genetic “algorithm”?

A

Basic Algorithm:

1) Start with k randomly generated states (population)

2) A state is represented as a string over a finite alphabet -often a string of 0s and 1s

3) Evaluation function (fitness function)

4) Produce the next generation by selection, cross-over, and mutation

35
Q

What is genetic programming?

A

Genetic programming is an optimization technique where computer programs are evolved to solve a problem. It uses principles of natural selection to create, mutate, and recombine programs, selecting the best ones each generation. Over time, this process produces programs that are increasingly effective at the given task.

36
Q

What is this?

A

Example of genetic programming operators

37
Q

Explain the Towers of Hanoi

A

Rules of the game:

  • you are only allowed to move one disk
  • you can only place a disk on top of a bigger disk (or the table)

Goal
- move the stack of disks from the first to the third peg

38
Q

What does Divide-and-Conquer refer to?

A

General problem solving strategy with many applications also called recursive programming.

39
Q

How to define the states in a “Constraint Satisfaction Problem” using symbols?

A

– state is defined by variables Xi with d values from domain Di

In a Constraint Satisfaction Problem (CSP):

•	Variables  X_i : Each variable represents an element of the problem that needs an assigned value. For example, in a scheduling problem, variables could represent time slots.

•	Domains  D_i : Each variable  X_i  has a domain  D_i , which is a set of possible values it can take. For instance, the domain for a time slot might be specific times of the day.

A state in the CSP is then defined by assigning specific values from each D_i to each X_i , such that these assignments respect the constraints of the problem. Constraints limit which combinations of values are valid across variables.

For example, in a map-coloring problem, variables are regions, domains are colors, and constraints prevent adjacent regions from having the same color. A state here is a specific assignment of colors to all regions.

40
Q

List example of “Constraint Satisfaction Problems” (CSPs)?

A
  • Sudoku
  • Cryptarithmetic puzzle
  • Graph/ Map-Colering
  • n-queens
41
Q

List Real-World CSPs

A
  • Assignment problems (e.g., who teaches what class)
  • Timetabling problems (e.g., which class is offered when and where?)
  • Hardware configuration
  • Spreadsheets
  • Scheduling (Job scheduling)
  • Floorplanning
42
Q

Draw a constraint graph for the australian states

(Two neighboring nodes must not have the same color)

A
43
Q

Explain the constrain graph?

A
  • nodes are variables
  • edges indicate constraints between them

In this case

B, D, X has a common constraint because B + D = D + X and A + X = A
Where X is 10 x X

44
Q

Draw the constraint graph for this cryptarithmetic puzzle

A
45
Q

Connected nodes in a constrain graph indicate that there are constraints between nodes. These constraints can also be written as equations. Write the constraint equations for this particular constraint graph?

A
46
Q

List the types of constraints in a constraint graph

A
  • Unary constraints
    (involve a single variable, – e.g., South Australia ≠ green)
  • Binary constraints
    (involve pairs of variables, – e.g., South Australia ≠ Western Australia)
  • Higher-order constraints
    (involve 3 or more variables, – e.g., 2⋅ W + X1=10⋅X2 + U)
  • Preferences (soft constraints)
    (– e.g., red is better than green
    – are not binding, but task is to respect as many as possible)
47
Q

Explain the two principal approaches for solving CSP problems?

A

Search:
– successively assign values to variable
– check all constraints
– if a constraint is violated → backtrack until all variables have assigned values

Constraint Propagation:
– maintain a set of possible values Di for each variable Xi
– try to reduce the size of Di by identifying values that violate
some constraints

48
Q

What is Backtracking search?

A
  • Systematic Exploration
  • Depth-First Approach
  • Constraint Satisfaction

Backtracking search is a method for solving problems by trying one choice at a time. If a choice leads to a conflict or dead-end, it “backtracks” to the previous step and tries a different option. This process repeats until it finds a solution that satisfies all conditions or concludes that no solution is possible.

49
Q

How can a search problem be defined?

A

For defining a search problem we need a:

  • state description and a
  • goal function
50
Q

What does Heuristics may help to do?

A

Guide the search into more promising regions of the search space

51
Q

What can you do to prevent that a local optima is found instead of the global optima we are looking for.

A
  • Random Restart Hill Climbing
  • Stochastic Hill Climbing
52
Q

What may Constraints help to avoid?

A

unnecessary search

53
Q

What general-purpose heuristics are there for selecting constrained variables and their values?

A
  1. Minimum Remaining Value (MRV) Heuristic: Choose the variable with the fewest possible values left. It prioritizes the most “constrained” variable, aiming to detect failure early.
  2. Degree Heuristic: If multiple variables have the same MRV, select the one involved in the most constraints with other unassigned variables. This helps reduce options for future choices, simplifying the problem.
  3. Least Constraining Value Heuristic: Once a variable is chosen, pick the value that leaves the most options open for remaining variables. It reduces the risk of conflicts later on.

These heuristics help solve problems more efficiently by guiding the search to avoid dead-ends.

54
Q

How does constraint propagation work?

A

– maintain a set of possible values Di for each variable Xi

– try to reduce the size of Di by identifying values that violate some constraints

Explanation
Constraint propagation works by reducing the possible values of variables based on constraints in the problem. When a variable is assigned a value, constraint propagation updates related variables to eliminate any values that would cause conflicts. This simplifies the problem by narrowing down choices early on, making it easier to find a solution or detect conflicts.

55
Q

Complex problems may be solved by reducing them to less
complex problems.

What is the key idea of divide-and-conquer?

A

1) Decompose the problem into simpler partial problems (DIVIDE)

2) Solve each of these simpler problems (CONQUER)

3) Combine the partial solutions to a complete solution

56
Q

How to define the states in a “Constraint Satisfaction Problem”?

A

In a Constraint Satisfaction Problem (CSP), states are defined by assignments of values to variables. Each state represents a partial or complete assignment where variables have been given values that must satisfy the problem’s constraints. A complete state is one where all variables are assigned, and a solution is found if it satisfies all constraints.