Geometry Lab [German] [Sitemap] [About geometrylab.de]

Theoretischer Hintergrund

Unter einer gitterförmigen Umgebung verstehen wir ein Polygon, das aus einzelnen Zellen zusammengesetzt ist. Wenn der Roboter sich in einer Zelle befindet, kann er ertasten, welche der Nachbarzellen zum Polygon gehören und welche Hinderniszellen sind, und kann sich auf eine benachbarte Zellen des Polygons bewegen. Die Aufgabe des Roboters ist, jede Zelle zu besuchen und dabei möglichst wenige Zellen mehrfach aufzusuchen.

Für den zweidimensionalen Fall sind bereits einige Strategien bekannt und sowohl theoretisch als auch exprimentell eingehend untersucht. Eine Experimentierumgebung in Form eines Java-Applets befindet sich unter http://web.informatik.uni-bonn.de/I/GeomLab/Gridrobot/.

Die Ziele dieser Arbeit sollten sein:

Es wurden bisher die Strategien Cell Explore und DFS umgesetzt.

Cell Explore in 3D

Es gibt 2 Modi:

Vorwärts-Modus:

Rückwärts-Modus:

Durch Optimierung des Rückwegs, d.h. durch entfernen überflüssiger reservierter Zellen kann die Anzahl der Schritte verringert werden.

DFS (Depth First Search)

Auch hier wird bei der Wahl der Richtungsreihenfolge nach der Linke-Hand-Regel verfahren. Die Reihenfolge ist im Prinzip egal, da DFS jede Zelle genau 2x besucht. D.h. die Reihenfolge der Aufrufe in der Prozedur ExploreCell ist beliebig.
ccw(dir) bedeutet Änderung der Richtung um 90° entgegen dem Uhrzeigersinn, ccw steht für counterclockwise. cw steht entsprechend für clockwise. Up und Down bezeichnen Konstanten für die Richtungen Oben und Unten.

Der Algorithmus arbeitet nach folgendem Prinzip:

procedure DFS(startcell, environment);
InitRobot();          // wähle dir so, dass in reverse(dir) eine Hindernis- oder Randzelle liegt
ExploreCell(dir);
end DFS;

procedure ExploreCell(dir);
if dir==Up oder dir==Down then
InitRobot();
ExploreStep(ccw(dir));
ExploreStep(dir);
ExploreStep(cw(dir));
ExploreStep(Up);
ExploreStep(Down);
end ExploreCell;

procedure ExploreStep(dir);
if existCell(dir) and unexplored(dir) then
move(dir);
ExploreCell(dir);
move(reverse(dir));
end ExploreStep;

Es wird zuerst eine Anfangsrichtung bestimmt und dann begonnen, das Gitter in dieser Richtung zu explorieren. ExploreCell versucht im Uhrzeigersinn (ausgehend von dir) die adjazenten, noch nicht besuchten Zellen über ExploreStep weiter zu explorieren. Ist die aktuelle Richtung oben oder unten, dann wird die Richtung mit InitRobot() neu bestimmt, da sonst die Funktionen ccw(dir) und cw(dir) nicht angewendet werden können. Die Bedingung, dass in reverse(dir) eine Hindernis- oder Randzelle liegt, kann dabei nicht immer eingehalten werden. Existiert eine Zelle in Richtung dir und ist diese noch nicht besucht, dann bewege den Roboter auf diese Zelle und exploriere die Zelle mit ExploreCell. Ist die Zelle vollständig exploriert, d.h. alle adjazenten Zellen sind schon besucht worden, dann gehe einen Schritt zurück. Mit anderen Worten gehe solange nach links bis es keine linke, adjazente und noch nicht besuchte Zelle mehr gibt, dann gehe falls möglich einen Schritt geradeaus. Ist jetzt auch geradeaus nicht möglich, dann gehe nach rechts. Ist rechts auch nicht möglich, dann bleiben noch oben und unten. Von der neu betretenen Zelle fange mit der Exploration wieder bei links an.


Ein kurze Einführung zur Benutzung des Applet finden Sie hier


© 2004 Institut für Informatik, Abt. I, Universität Bonn
Autor: Christine Dienelt
Bitte senden Sie Kommentare an:
:]

Theoretical Background

With gridlike environment we mean a polygon, that consists of single cells. When the robot is located in a cell, he can recognize which of the adjacent cells belong to the polygon and which are obstacle cells, and then he can move to an adjacent cell of the polygon. The task of the robot is to visit every cell and in doing so to visit only a few cells several times.

For the 2-dimensional case there are already several strategies known which are theoretical and also experimental examined in detail. You will found an experimental environment in form of an applet under http://web.informatik.uni-bonn.de/I/GeomLab/Gridrobot/.

The aims of this work should be:

At the moment the strategies Cell Explore and DFS are implemented.

Cell Explore in 3D

There are two modes:

Forward mode:

Backward mode:

Optimizing the return path means deleting redundant reserved cells and so lessen the number of steps.

DFS (Depth First Search)

Here the order of the directions is managed by the Left-Hand-Rule, too. In principle the order don't mind, because DFS visits every cell exactly 2 times. That means the order of the calls in the routine ExploreCell is arbitrary.
ccw(dir) causes a change of the direction of 90° counterclockwise, cw a change of 90° clockwise. Up and Down denote constants for the corresponding directions.

The following code shows the principle of the algorithm:

procedure DFS(startcell, environment);
InitRobot();          // choose dir so that the cell in reverse(dir) is an obstacle or edge cell
ExploreCell(dir);
end DFS;

procedure ExploreCell(dir);
if dir==Up or dir==Down then
InitRobot();
ExploreStep(ccw(dir));
ExploreStep(dir);
ExploreStep(cw(dir));
ExploreStep(Up);
ExploreStep(Down);
end ExploreCell;

procedure ExploreStep(dir);
if existCell(dir) and unexplored(dir) then
move(dir);
ExploreCell(dir);
move(reverse(dir));
end ExploreStep;

First the starting direction is determined and then the algorithm starts to explorate the grid in this direction. ExploreCell tries to explorate counterclockwise (beginning with dir) the adjacent unvisited cells with ExploreStep. Is the actual direction up or down then a new direction is determinend by InitRobot, because otherwise the functions ccw(dir) and cw(dir) couldn't be applied. Thereby the condition that the cell in reverse(dir) is an obstacle or edge cell can't always be kept. Exists a cell in the direction dir which isn't yet visited, then move the robot on this cell and explorate the cell with ExploreCell. Is the cell completely explorated, i.e. all adjacent cells are already visited then step back. In other words take a step to the left until there is no more adjacent unvisited cell to the to left, in this case take a step forward. No step forward is possible, too, then take a step to the right. A step to the right isn't possible, too, then there are left the directions up and down. Start the further exploration on the new entered cell again with the left side.


A short introduction into the usage of the applet you will find here.


© 2004 Institute of Computer Science, Dept. I, University of Bonn
Author: Christine Dienelt
Pleas send comments to:

 

© University of Bonn, Computer Science I - - Last modified 03-03-2008 13:21