Sha256: 165f323b26ca96f4af3c2ce16946d22d1d5b727103b7619c80ed25f5122bb85a

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

module XPFlow

    class Experiment

        attr_reader :results

        def initialize(name, results_path, parent = nil)
            @name = name
            @parent = parent
            @results = Collection.new(results_path)
            @results.create_path()
            @log_filename = File.join(results_path, "experiment.log")
            @log_file = FileLog.new(@log_filename).open()
        end

        def create_subexperiment(name)
            new_path = File.join(@results.path, name)
            return Experiment.new(name, new_path, self)
        end

        def install
            return self
        end

        def log(*msgs)
            @log_file.log(*msgs)
            @parent.log(*msgs) unless @parent.nil?
        end

        def store_execution(execution)
            # puts execution
            # here we should store the execution so that it will be solved
        end

        def store_executions(array)
            array.each { |x| store_execution(x) }
        end

    end

    class ExperimentBlackHole

        # a version of Experiment that consumes eveything it is given
        # used in a testsuite

        def initialize(*args); end

        def create_subexperiment(name)
            return ExperimentBlackHole.new()
        end

        def install
            return self
        end

        def log(*msgs); end

        def store_execution(x); end

        def store_executions(x); end

    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xpflow-0.1c lib/xpflow/experiment.rb
xpflow-0.1b lib/xpflow/experiment.rb