90 likes | 104 Views
Homework Assignment 1: Modeling the Tangram Puzzle in UML and OCL. Jacques Robin & Franklin Ramalho. The Tangram Puzzle Specification. A set I i of polygon instances from a set of polygon sub-classes P i lay on a table in an initial random configuration I i is partitioned into:
E N D
Homework Assignment 1: Modeling the Tangram Puzzlein UML and OCL Jacques Robin & Franklin Ramalho
The Tangram Puzzle Specification • A set Ii of polygon instances from a set of polygon sub-classes Pi lay on a table in an initial random configuration • Ii is partitioned into: • Atomic polygon instances that are made of a single piece • Compound polygon instances that result from joining several polygons by laying them on the table in positions such that their sides are aligned in contact which each other • A compound polygon instance generally belongs to a different class than its atomic (or recursively compound) components • A configuration is defined solely by: • The number of instances of each polygon class laying on the table • Which sides of this instance set are in contact (i.e.,joined) to form compound polygons • The puzzle consists in disjoining and joining some of these polygons to assemble on the table another goal set of polygons instances Ig taken from a possible distinct goal set of polygon sub-classes Pg
The Tangram Puzzle Specification • The puzzle is executed by an robotic agent: • Which sensors provide full information on about: • How many instances of each polygon class lay on the table, • Which of these instances are atomic and compound, and • For compound polygons what is their recursive decomposition in sub-components, sub-sub-components etc. until the bottom embedding level of atomic components. • Which actuators allow moving one atomic polygon either: • From a position where it is joined with another polygon (atomic or compound) to form a third compound polygon to a position where it is alone, disjoint from any other polygon • From such an isolated position, to a position where it is joined with another polygon (atomic or compound) to form a third compound polygon
What is a Polygon?A closed plane figure made up of several line segments that are joined together. The sides do not cross each other. Exactly two sides meet at every vertex. Types | Formulas | Parts | Special Polygons | Names Types of PolygonsRegular - all angles are equal and all sides are the same length. Regular polygons are both equiangular and equilateral.Equiangular - all angles are equal.Equilateral - all sides are the same length. Polygon Formulas(N = # of sides and S = length from center to a corner) Area of a regular polygon = (1/2) N sin(360°/N) S2 Sum of the interior angles of a polygon = (N - 2) x 180° The number of diagonals in a polygon = 1/2 N(N-3)The number of triangles (when you draw all the diagonals from one vertex) in a polygon = (N - 2) Polygon Parts Revision of Polygonal Geometry • http://www.mathleague.com/help/geometry/polygons.htm#polygon • http://www.math.com/tables/geometry/polygons.htm Special PolygonsSpecial Quadrilaterals - square, rhombus, parallelogram, rectangle, and the trapezoid. Special Triangles - right, equilateral, isosceles, scalene, acute, obtuse. Polygon NamesGenerally accepted names Names for other polygons have been proposed.
Example of Tangram Puzzle Input:Initial and Goal Configurations • Initial configuration: • Two convex quadrilaterals • Each one assembled from one equilateral triangle joint with a right triangle on the opposite side of the right angle triangle • Goal configuration: • One convex hexagon, assembled from two equilateral triangles and one square • where the square is itself recursively assembled from two right triangles
RT1 RT2 ET1 ET2 Move ET2 from RT2 to Table RT1 RT2 ET1 ET2 Move RT2 from Table to RT1 RT1 RT2 ET1 ET2 Move ET2 from Table to RT2 RT1 RT2 ET2 ET1 Example of Tangram Puzzle Output:Sequence of Actions
Topic Variations and Allocation • Roster divided in teams of at most 5 students • Each team chooses one of the following topic variations: • Topic 1: • Atomic sub-classes: only triangles • Input sub-classes: any convex polygon of at most 8 sides • Goal sub-classes: any convex polygon of at most 8 sides • Topic 2: • Atomic sub-classes: any convex polygon of at most 6 sides • Input sub-classes: any convex polygon of at most 6 sides • Goal sub-classes: any convex polygon of at most 6 sides • Topic 3: • Atomic sub-classes: any regular convex polygon of at most 10 sides • Input sub-classes: any regular convex polygon of at most 10 sides • Goal sub-classes: any regular convex polygon of at most 10 sides
Topic Variations and Allocation • Topic 4: • Atomic sub-classes: only right triangles • Input sub-classes: any rightconvex polygon of at most 8 sides • Goal sub-classes: any rightconvex polygon of at most 8 sides • Topic 5: • Atomic sub-classes: only triangles • Input sub-classes: any concave polygon of at most 12 sides • Goal sub-classes: any concave polygon of at most 12 sides • Topic 6: • Atomic sub-classes: any regular concave polygon of at most 8 sides • Input sub-classes: any regular concave polygon of at most 8 sides • Goal sub-classes: any regular concave polygon of at most 8 sides • Topic 7: • Atomic sub-classes: only triangles • Input sub-classes: any regular convex polygon of at most 6 sides • Goal sub-classes: any regular concave polygon of at most 8 sides
Artifacts to Constructs • Ontology of the relevant polygon classes as an UML class diagram associated with OCL invariants and defaults • Test set of input pair configurations (initial configuration and corresponding goal configuration) as a set of UML object diagram pairs • Robotic agent’s structural model as an UML class diagram with OCL invariants and defaults • Robotic agent’s behavioral model as OCL bodies, derivation rules and method pre and post conditions