atom_krr2014.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 from .atom import Atom
00004 
00005 class AtomKRR2014(Atom):
00006 
00007     ACTION_NAMES = ["askploc", "greet", "gothrough", "opendoor", "approach"]
00008     FLUENT_NAMES = ["at", "open", "visiting", "beside", "open", 
00009                     "beside", "inside", "goal", "facing"]
00010 
00011     def __init__(self, name, value=None, time=None, negated=False):
00012         super(AtomKRR2014, self).__init__(name, value, time, negated)
00013 
00014         if self.type == None:
00015             if self.name in AtomKRR2014.ACTION_NAMES:
00016                 self.type = Atom.ACTION
00017             elif self.name in AtomKRR2014.FLUENT_NAMES:
00018                 self.type = Atom.FLUENT
00019             else:
00020                 self.type == Atom.TERM
00021 
00022     def conflicts_with(self, other):
00023         """
00024           Test for hard negation conflict and uniqueness constraints only.
00025         """
00026 
00027         if super(AtomKRR2014, self).conflicts_with(other):
00028             return True
00029 
00030         # Check for uniqueness constraints
00031         if (self.name == "at" and other.name == "at" or \
00032             self.name == "facing" and other.name == "facing" or \
00033             self.name == "beside" and other.name == "beside") and \
00034            self.value != other.value and \
00035            not self.negated and not other.negated:
00036             return True
00037 
00038         # Check for uniqueness constraint for inside
00039         # if the person is same, but the location is different and both 
00040         # fluents are not negated
00041         if self.name == "inside" and other.name == "inside" and \
00042            self.value.value[0] == other.value.value[0] and \
00043            self.value.value[1] != other.value.value[1] and \
00044            not self.negated and not other.negated:
00045             return True
00046 
00047         return False
00048 


bwi_planning
Author(s): Piyush Khandelwal , Fangkai Yang
autogenerated on Wed Aug 26 2015 10:54:52