# Path: retired/planners/connectivity_graph/utils.py
# PRUNE_INACTIVE = False
# 
# CYCLE_INACTIVE = PRUNE_INACTIVE
# 
# UPDATE_INACTIVE = False


from .connectivity_graph import *
from misc.utils import *
from .utils import PRUNE_INACTIVE, CYCLE_INACTIVE, UPDATE_INACTIVE
    from pygraphviz import AGraph # NOTE - LIS machines do not have pygraphviz
      subplanner.generation_history[self.state_uses[start]] += 1 # NOTE - This should also be updated on the first call
      if subplanner.exhausted:
        # TODO - something special if the problem is exhausted
        continue
      if subplanner.goal_connector.active and not subplanner.queued:
        self.queue.append(subplanner); subplanner.queued = True

    #nodes = self.vertices.values() + self.edges.values() + self.connectors.values()
    #for n in nodes: if n.active: print n,
    #print
    #print sum(n.active for n in nodes), '/', len(nodes)
    #print 'Goal reachable:', self.goal.reachable
    #print 'Goal active:', self.goal.active
    #self.graph('end.pdf', reachable=False)
    #raw_input()

    #print
    #print 'Done'
    #print len(self.vertices) - start_vertices, len(self.connectors) - start_connectors, len(self.edges) - start_edges
    #print iterations, cycles
    reachable = self.goal.reachable
    exhausted = len(self.queue) == 0
    self.state_uses[start] += 1
    self.total_time += time() - start_time; self.total_iterations += iterations; self.total_cycles += cycles
    return reachable, exhausted

  ###########################################################################

  # TODO - costs dependent on mode switches
  def costs(self, op=max, unit=False, greedy=True):

# Path: retired/planners/connectivity_graph/utils.py
# PRUNE_INACTIVE = False
# 
# CYCLE_INACTIVE = PRUNE_INACTIVE
# 
# UPDATE_INACTIVE = False


# Path: retired/planners/connectivity_graph/relaxed_connectivity_graph.py
from .connectivity_graph import *
from misc.utils import *
from .utils import PRUNE_INACTIVE, CYCLE_INACTIVE, UPDATE_INACTIVE
    from pygraphviz import AGraph # NOTE - LIS machines do not have pygraphviz

      subplanner.generation_history[self.state_uses[start]] += 1 # NOTE - This should also be updated on the first call
      if subplanner.exhausted:
        # TODO - something special if the problem is exhausted
        continue
      if subplanner.goal_connector.active and not subplanner.queued:
        self.queue.append(subplanner); subplanner.queued = True

    #nodes = self.vertices.values() + self.edges.values() + self.connectors.values()
    #for n in nodes: if n.active: print n,
    #print
    #print sum(n.active for n in nodes), '/', len(nodes)
    #print 'Goal reachable:', self.goal.reachable
    #print 'Goal active:', self.goal.active
    #self.graph('end.pdf', reachable=False)
    #raw_input()

    #print
    #print 'Done'
    #print len(self.vertices) - start_vertices, len(self.connectors) - start_connectors, len(self.edges) - start_edges
    #print iterations, cycles
    reachable = self.goal.reachable
    exhausted = len(self.queue) == 0
    self.state_uses[start] += 1
    self.total_time += time() - start_time; self.total_iterations += iterations; self.total_cycles += cycles
    return reachable, exhausted

  ###########################################################################

  # TODO - costs dependent on mode switches
  def costs(self, op=max, unit=False, greedy=True):

    self.op, self.unit = op, unit