OntologiesReasoningComponentsAgentsSimulations
Homework Assignment 1: Homework Assignment 1: Modeling the Tangram PuzzleModeling the Tangram Puzzle
in UML and OCLin UML and OCL
Jacques Robin& Franklin Ramalho
2
The Tangram Puzzle SpecificationThe 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
3
The Tangram Puzzle SpecificationThe 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
4
Revision of Polygonal GeometryRevision of Polygonal Geometry
http://www.mathleague.com/help/geometry/polygons.htm#polygon
http://www.math.com/tables/geometry/polygons.htm
5
Example of Tangram Puzzle Input:Example of Tangram Puzzle Input:Initial and Goal ConfigurationsInitial 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
6
Example of Tangram Puzzle Output:Example of Tangram Puzzle Output:Sequence of ActionsSequence of Actions
ET1RT1
ET2RT2
ET1RT1
ET2RT2
ET1RT1
ET2RT2
Move ET2 from RT2 to Table
ET1RT1
ET2RT2
Move RT2from Table to RT1
Move ET2from Table to RT2
7
Topic Variations and AllocationTopic 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
8
Topic Variations and AllocationTopic Variations and Allocation
Topic 4: Atomic sub-classes: only right triangles Input sub-classes: any right convex polygon of at most 8 sides Goal sub-classes: any right convex 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
9
Artifacts to ConstructsArtifacts 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