• Keine Ergebnisse gefunden

Foundations of Artificial Intelligence

N/A
N/A
Protected

Academic year: 2022

Aktie "Foundations of Artificial Intelligence"

Copied!
2
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Foundations of Artificial Intelligence

M. Helmert J. Seipp

Spring Term 2019

University of Basel Computer Science

Exercise Sheet 6

Due: April 10, 2019 Exercise 6.1(1.5+1.5 marks)

(a) Avertex coverof a given input graphGis a subset of the vertices ofGsuch that every edge of Ghas at least one of its end points in the subset. Formalize the combinatorial optimization problem (COP) of finding a vertex cover of minimal size. Is the COP a pure search problem, a pure optimization problem, or a combined search and optimization problem?

(b) AHamilton path of a directed graphGis a path throughGthat visits each vertex exactly once. Thelongest Hamilton path of a directed graphGwith (positive) weighted edges is the Hamilton path with the maximal sum of edge weights.

Formalize the combinatorial optimization problem (COP) of finding a longest Hamilton path in a fully connected graph, i.e., there is an edge between all pairs of vertices in the graph.

Is the COP a pure search problem, a pure optimization problem, or a combined search and optimization problem?

Exercise 6.2(1.5+2+0.5+2 marks)

The task in this exercise is to write a software program. We expect you to implement your code on your own, without using existing code (such as examples you find online). If you encounter technical problems or have difficulties understanding the task, please let us know.

Download the file hill-climbing.tar.gzfrom the website of the course. It contains an incom- plete implementation of hill climbing search for the 8 queens problem that was presented in the lecture.

(a) Implement the heuristic for the 8 queens problem that is presented on Slide 22 of Chapter 20 (print version), where the heuristic value is equal to the number of pairs of queens threatening each other. To do so, implement the functionpublic int h(Configuration conf)in the fileEightQueensProblem.java.

(b) Implement hill climbing in the function protected SearchResult search() in the file HillClimbing.java. Since our heuristic is such that smaller values are better, we are con- sidering a minimization variant here, so adapt the function presented on Slide 20 of Chapter 20 (print version) accordingly. Break ties among neighbors with minimal heuristic value uni- formly at random. Note thatprotected SearchResult search()returns aSearchResult object, which contains information if hill climbing found a solution and on the number of steps.

(c) Test your implementation by verifying the statements on Slide 23 of Chapter 20 (print version), which state that hill climbing with a random initialization finds a solution in around 14% of the cases using around 4 steps on average. You can compile and run your code with javac HillClimbing.java followed by the commandjava HillClimbing 8queens.

Report the percentage of successful runs and the average number of steps.

(d) Copy your hill climbing implementation into a new fileHillClimbingWithStagnation.java.

Adapt the implementation such that steps without improvement (stagnation) are allowed as described on Slide 8 of Chapter 21 (print version). Verify that approximately 94% of the runs with a bound of 100 steps yield a solution, and that a solution is found after 21 steps on average. What is the percentage of successful runs and the average number of steps for your solution?

(2)

Exercise 6.3(1.5+0.5+0.5+0.5 marks)

Consider the following example instance of the graph coloring problem:

b, g v1

g, r v2

b, r v3

b, g, r v4

(a) Formalize the example as a binary constraint network.

(b) Is the constraint network solvable? If yes, provide a solution of the constraint network. If not, justify your answer.

(c) Provide a consistent partial assignment thatcannot be extended to a solution and that is such that the partial assignment assigns values to as few variables as possible.

(d) Provide an inconsistent partial assignment.

Important: Solutions should be submitted in groups of two students. However, only one student should upload the solution. Please provide both student names on each file and each page you submit. We can only accept a single PDF or a ZIP file containing *.java or *.pddl files and a single PDF.

Referenzen

ÄHNLICHE DOKUMENTE

(b) Test your implementation by verifying the statements on Slide 24 of Chapter 20 (print version), which state that hill climbing with a random initialization finds a solution

Provide a worst-case runtime estimate of the algorithm based on cutset conditioning if your cutset from the first part of this exercise is used (i.e., compute an upper bound for

Perfom DPLL on the clause set {{A, ¬B}, {¬A, B}, {B, ¬D}, {C}, {¬C, ¬B, ¬D}, {C, D}}, always picking the variable occuring in the highest number of clauses and always considering

In cases where the precondition choice function is not deterministic, choose the precondition in alphabetical order.. Exercise 11.3

– one line for each table position: maximum number of blocks in the tower at this table position, followed by the IDs of the blocks in the initial state, starting from the surface

Successor nodes are generated by applying the following actions in order, ignoring the ones that are inapplicable in a given state: transport 2 missionaries, transport 1

Provide a worst-case runtime estimate of the algorithm based on cutset conditioning if your cutset from the first part of this exercise is used (i.e., compute an upper bound for

The domain description (variables and actions) is given in the file bridges-once-domain.pddl, and the problem description (objects, initial state and goal description) is given in