Class: Roby::Schedulers::Global::RelaxationGraph

Inherits:
Relations::BidirectionalDirectedAdjacencyGraph show all
Defined in:
lib/roby/schedulers/global.rb

Overview

Internal graph used by #relax_group_scheduling_constraints

The graph vertices are scheduling groups. An edge u->v represents that 'u' is held by something that should happen in 'v'. The graph allows self-edges

Instance Attribute Summary

Attributes inherited from Relations::BidirectionalDirectedAdjacencyGraph

#backward_edges, #forward_edges_with_info

Instance Method Summary collapse

Methods inherited from Relations::BidirectionalDirectedAdjacencyGraph

#==, [], #add_or_update_edge, #add_vertex, #clear, #dedupe, #delete_vertex_if, #difference, #directed?, #each_edge, #each_in_neighbour, #each_out_neighbour, #each_vertex, #edge_info, #eql?, #freeze, #has_edge?, #has_vertex?, #hash, #in_degree, #in_neighbours, #initialize_copy, #leaf?, #merge, #move_edges, #num_edges, #num_vertices, #out_degree, #propagate_transitive_closure, #remove_edge, #remove_vertex, #remove_vertex_relations!, #replace, #reverse, #reverse!, #root?, #same_structure?, #set_edge_info, #to_a, #verify_consistency, #vertices

Methods included from DRoby::V5::BidirectionalGraphDumper

#droby_dump

Constructor Details

#initializeRelaxationGraph

Returns a new instance of RelaxationGraph.



326
327
328
329
330
# File 'lib/roby/schedulers/global.rb', line 326

def initialize
    @self_edges = Set.new
    @self_edges.compare_by_identity
    super
end

Instance Method Details

#add_edge(group, holding_group) ⇒ Object



332
333
334
335
336
337
338
339
# File 'lib/roby/schedulers/global.rb', line 332

def add_edge(group, holding_group)
    if group == holding_group
        add_vertex(group)
        @self_edges << group
    else
        super
    end
end

#out_neighbours(group) ⇒ Object



341
342
343
344
345
# File 'lib/roby/schedulers/global.rb', line 341

def out_neighbours(group)
    neighbours = super
    neighbours |= [group] if @self_edges.include?(group)
    neighbours
end