Sha256: 04b4c025013bb6d1e3be4650639cff4c65a3b1eed4b0b25c75a6ac6392453183
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>. # Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved. # License:: LGPL # $Id: ProbabilityThreshold.rb 567 2005-04-13 08:00:06Z polrop $ module TTK module Strategies class ProbabilityThreshold < 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 fail("Not enough (#@final_weight)") 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 ProbabilityThreshold end # module Strategies end # module TTK
Version data entries
5 entries across 5 versions & 1 rubygems