Sha256: 820719dc606635f15bb7c924424c66b7a6e30487cee4d89cd78c50d9f86b0ace

Contents?: true

Size: 1.65 KB

Versions: 5

Compression:

Stored size: 1.65 KB

Contents

module Distributions
    class Gaussian
	attr_reader :mean, :dev
	def initialize(mean, dev)
	    @mean, @dev = mean, dev
	end
    end
end

module Roby
    # A TimeDistribution object describes the evolution of a 
    # value object w.r.t. time. Time can be described by absolute
    # values using Time objects or w.r.t. the plan by using 
    # EventGenerator objects
    class TimeDistribution
	attr_reader :info
	def initialize(info)
	    @info = info
	    @timepoints = Array.new
	end

	# Set the predicted value of the distribution at +event+
	def set_value(event, value)
	    @timepoints << [event, :set_value, value]
	end

	# Set a decay function which is valid from +event+
	def set_decay(event, decay)
	    @timepoints << [event, :set_decay, decay]
	end

	# Set the knowledge value for the distribution at +event+
	# For now, the only valid values are 0 (nothing known) 
	# and 1 (perfectly known)
	def set_knowledge(event, value = 1.0)
	    @timepoints << [event, :set_knowledge, value]
	end
    end

    class Task < PlanObject
	inherited_enumerable(:needed_information) { Array.new }
	inherited_enumerable(:improved_information) { Array.new }
	
	# This task is influenced by the information contained in +info+
	def self.needs(info); needed_information << info end
	def self.needs?(info); enum_for(:each_needed_information).any? { |i| info === i } end
	def needs?(info); self.model.needs?(info) end

	# This task will improve the information contained in +info+
	def self.improves(info); improved_information << info end
	def self.improves?(info); enum_for(:each_improved_information).any? { |i| info === i } end
	def improves?(info); self.model.improves?(info) end
    end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
roby-0.8.0 lib/roby/state/information.rb
roby-0.7.2 lib/roby/state/information.rb
roby-0.7.1 lib/roby/state/information.rb
roby-0.7 lib/roby/state/information.rb
roby-0.7.3 lib/roby/state/information.rb