# Path: retired/discrete/subplanners.py
# class DiscreteSubplanner(Subplanner):
#   def __init__(self, operators):
#     self.operators = operators
#   def generator(self, start_vertex, goal_connector, rg):
#     #yield # NOTE - include if don't want initial generation
#     vertex = rg.vertex(goal_connector.condition.substate)
#     vertex.connect(goal_connector)
#     variable, value = list(vertex.substate)[0]
# 
#     for operator in self.operators:
#       if variable in operator.effects:
#         effect = operator.effects[variable]
#         if is_discrete_effect(effect) and effect.value == value:
#           rg.edge(operator).connect(vertex)
#     yield
# 
# Path: retired/discrete/operators.py
# def is_discrete_condition(condition):
#   return isinstance(condition, SubstateCondition) and len(condition.substate) == 1
# 
# def is_discrete_effect(effect):
#   return isinstance(effect, ValueEffect)
# 
# def is_discrete_operator(operator):
#   for condition in operator.conditions:
#     if not is_discrete_condition(condition):
#       return False
#   for _, effect in operator.effects.items():
#     if not is_discrete_effect(effect):
#       return False
#   return True
# 
# def connect_discrete_conditions(rg, edge):
#   for connector in edge.connectors:
#     if is_discrete_condition(connector.condition):
#       vertex = rg.vertex(connector.condition.substate)
#       vertex.connect(connector)
#       if rg.start.substate in connector.condition:
#         rg.start.connect(connector)
# 
# def connect_discrete_operator(rg, edge):
#   connect_discrete_conditions(rg, edge)
#   connect_discrete_effects(rg, edge)


from .subplanners import DiscreteSubplanner
from .operators import is_discrete_condition, is_discrete_effect, is_discrete_operator, \
  connect_discrete_conditions, connect_discrete_operator

    for operator in self.operators:
      if variable in operator.effects:
        effect = operator.effects[variable]
        if is_discrete_effect(effect) and effect.value == value:
          self.rg.edge(operator).connect(vertex)
    return []

class SubplannerDiscreteScheduler(Scheduler):
  def __init__(self, rg, operators):
    super(self.__class__, self).__init__(rg)
    self.subplanner = DiscreteSubplanner(operators)
  def __call__(self, start_vertex, goal_connector):
    return [self.subplanner(start_vertex, goal_connector, self.rg)]

class SeparateSubplannerDiscreteScheduler(Scheduler):
  def __init__(self, rg, operators):
    super(self.__class__, self).__init__(rg)
    self.operators = operators
  def __call__(self, start_vertex, goal_connector):
    assert is_discrete_condition(goal_connector.condition)

    vertex = self.rg.vertex(goal_connector.condition.substate)
    vertex.connect(goal_connector)
    variable, value = list(vertex.substate)[0]

    subplanners = []
    for operator in self.operators:
      if variable in operator.effects:
        effect = operator.effects[variable]

# Path: retired/discrete/subplanners.py
# class DiscreteSubplanner(Subplanner):
#   def __init__(self, operators):
#     self.operators = operators
#   def generator(self, start_vertex, goal_connector, rg):
#     #yield # NOTE - include if don't want initial generation
#     vertex = rg.vertex(goal_connector.condition.substate)
#     vertex.connect(goal_connector)
#     variable, value = list(vertex.substate)[0]
# 
#     for operator in self.operators:
#       if variable in operator.effects:
#         effect = operator.effects[variable]
#         if is_discrete_effect(effect) and effect.value == value:
#           rg.edge(operator).connect(vertex)
#     yield
# 
# Path: retired/discrete/operators.py
# def is_discrete_condition(condition):
#   return isinstance(condition, SubstateCondition) and len(condition.substate) == 1
# 
# def is_discrete_effect(effect):
#   return isinstance(effect, ValueEffect)
# 
# def is_discrete_operator(operator):
#   for condition in operator.conditions:
#     if not is_discrete_condition(condition):
#       return False
#   for _, effect in operator.effects.items():
#     if not is_discrete_effect(effect):
#       return False
#   return True
# 
# def connect_discrete_conditions(rg, edge):
#   for connector in edge.connectors:
#     if is_discrete_condition(connector.condition):
#       vertex = rg.vertex(connector.condition.substate)
#       vertex.connect(connector)
#       if rg.start.substate in connector.condition:
#         rg.start.connect(connector)
# 
# def connect_discrete_operator(rg, edge):
#   connect_discrete_conditions(rg, edge)
#   connect_discrete_effects(rg, edge)


# Path: retired/discrete/schedulers.py
from .subplanners import DiscreteSubplanner
from .operators import is_discrete_condition, is_discrete_effect, is_discrete_operator, \
  connect_discrete_conditions, connect_discrete_operator


    for operator in self.operators:
      if variable in operator.effects:
        effect = operator.effects[variable]
        if is_discrete_effect(effect) and effect.value == value:
          self.rg.edge(operator).connect(vertex)
    return []

class SubplannerDiscreteScheduler(Scheduler):
  def __init__(self, rg, operators):
    super(self.__class__, self).__init__(rg)
    self.subplanner = DiscreteSubplanner(operators)
  def __call__(self, start_vertex, goal_connector):
    return [self.subplanner(start_vertex, goal_connector, self.rg)]

class SeparateSubplannerDiscreteScheduler(Scheduler):
  def __init__(self, rg, operators):
    super(self.__class__, self).__init__(rg)
    self.operators = operators
  def __call__(self, start_vertex, goal_connector):
    assert is_discrete_condition(goal_connector.condition)

    vertex = self.rg.vertex(goal_connector.condition.substate)
    vertex.connect(goal_connector)
    variable, value = list(vertex.substate)[0]

    subplanners = []
    for operator in self.operators:
      if variable in operator.effects:
        effect = operator.effects[variable]

        if is_discrete_effect(effect) and effect.value == value: