コード例 #1
0
ファイル: partial_context.py プロジェクト: abramovd/explr-2
 def complete(self, implications):
     for o in self.objects:
         xintent = self.x_context.get_object_intent(o)
         new_xintent = closure(xintent, implications)
         qintent = self.q_context.get_object_intent(o)
         if not new_xintent <= qintent:
             # TODO: undo the modifications
             raise ValueError(
                 'implications are inconsistent with the partial context')
         self.x_context.set_object_intent(new_xintent, o)
         new_qintent = set([
             a for a in qintent if a in new_xintent
             or closure(new_xintent | set([a]), implications) <= qintent
         ])
         self.q_context.set_object_intent(new_qintent, o)
         # TODO: Remove printing
         if xintent != new_xintent or qintent != new_qintent:
             print 'Object', o
             print self._intent_to_str(xintent, qintent)
             print 'completed to '
             print self._intent_to_str(new_xintent, new_qintent)
コード例 #2
0
ファイル: partial_context.py プロジェクト: artreven/fca
 def complete(self, implications):
     for o in self.objects:
         xintent = self.x_context.get_object_intent(o)
         new_xintent = closure(xintent, implications)
         qintent = self.q_context.get_object_intent(o)
         if not new_xintent <= qintent:
             # TODO: undo the modifications
             raise ValueError(
                 'implications are inconsistent with the partial context')
         self.x_context.set_object_intent(new_xintent, o)
         new_qintent = set([a for a in qintent
                              if a in new_xintent or
                              closure(new_xintent | {a}, implications)
                                                                 <= qintent
                          ])
         self.q_context.set_object_intent(new_qintent, o)
         # TODO: Remove printing
         if xintent != new_xintent or qintent != new_qintent:
             print('Object', o)
             print(self._intent_to_str(xintent, qintent))
             print('completed to ')
             print(self._intent_to_str(new_xintent, new_qintent))
コード例 #3
0
 def provide_counterexample(self, imp):
     return (str(imp.premise), closure(imp.premise, self.basis))
コード例 #4
0
 def is_valid(self, imp):
     return imp.conclusion <= closure(imp.premise, self.basis)
コード例 #5
0
ファイル: explorationtest.py プロジェクト: artreven/fca
 def provide_counterexample(self, imp):
     return (str(imp.premise), closure(imp.premise, self.basis))
コード例 #6
0
ファイル: explorationtest.py プロジェクト: artreven/fca
 def is_valid(self, imp):
     return imp.conclusion <= closure(imp.premise, self.basis)