Sha256: 1e869518d919fc66eff51daaad7be93064564eb3d99c1d3ddd47794d0e4e1f19
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 KB
Contents
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>. # Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved. # License:: LGPL # $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Threshold.rb 23188 2006-04-01T12:55:14.164563Z ertai $ module Uttk module Strategies # I validate the status of the strategy _test_ if it is under the value of # my _threshold_ attribute. class Threshold < Proxy include Concrete def prologue super if @threshold > 1 raise ArgumentError, "Threshold too high: #@threshold not in [0..1]" elsif @threshold < 0 raise ArgumentError, "Threshold too low: #@threshold not in [0..1]" end create(@test) end protected :prologue def assertion compute_final_weight final = @final_weight.get @log.final_weight = final fail("Not enough (#{final} < #@threshold)") if @final_weight < @threshold pass end protected :assertion attribute :test, 'the strategy', :mandatory, :invisble attribute :threshold, 'the probability threshold', :mandatory, nil Weights::Weight end # class Threshold end # module Strategies end # module Uttk
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
uttk-0.4.5.0 | lib/uttk/strategies/Threshold.rb |
uttk-0.4.6.2 | lib/uttk/strategies/Threshold.rb |
uttk-0.4.6.1 | lib/uttk/strategies/Threshold.rb |