One of the requirements in Logistics Domain is inheritance of object types. For example, the airports are also depots (trucks travel from depot to depot). Therefore airport is a derived class of depot.
Updated on 15 April 2009:
Inheritance (Is-a) and Containment (Has-a) relations between ObjectType s are implemented in Crackpot.
Inheritance
An example of inheritance in Logistics Domain is: Trucks travel from depot to depot. The airports are also depots as trucks travel to airports too. Therefore airport is a derived class of depot.
Changes made for implementation of inheritance:
1. Added a class called ObjectTypeRelationsContainer for containing the "directly" derived types. This class contains a 2-column table with each row containing a base and derived class. This class has a wrapper interface to find all directly derived object types called getDirectlyDerivedObjectTypeRange and a class to find all derived types of a type called getAllDerivedObjectTypes.
2. Added into interface of DomainPackage: functions to find all "directly" derived types of a type called getDirectlyDerivedObjectTypeRange, and inherited attributes of a type called getInheritedAttributeTypesOfObjectType (another function getAttributeTypesOfObjectType returns attributes but not inherited attributes). After the domain definition is read, the DomainPackage::postInitialize function is called. Inside this function, all attributes of base classes are inserted as attributes of derived classes too. In DomainPackageUtils class: added function getGroundObjectInstancesOfAllDerivedObjectTypes which returns all ground object instances of derived object types of a base type.
During planning, when an object parameter is instantiated, the planner uses getGroundObjectInstancesOfAllDerivedObjectTypes as the starting point to find an appropriate object instance.
Inheritance from multiple ObjectTypes are allowed (but not tested till now). No error checks like same attribute names in base classes etc is implemented.
Containment
Containment is implemented through object references. The value of an attribute which refers to another object in the domain is called an ObjectReferenceAttributeValueInstance.
Idea: Unlike our other interfaces, getAllDerivedObjectTypes returns a set, and not a range of iterators. A range class should be defined so that it also contains a pointer to its container. Then the range can be returned, and no need to returning the set explicitly.
Observations: the DomainPackage class is growing bigger everyday. This is not scalable. It needs to be broken down. It should delegate tasks to smaller classes - for objects and attributes, another for actions, and so on.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment