Sha256: 871f1bf3263fd5ec8cf7c7b0407bc38812e44180db29a81e56cead76a7d823b1
Contents?: true
Size: 1021 Bytes
Versions: 1
Compression:
Stored size: 1021 Bytes
Contents
module Ravensat module Claw def self.alo(bool_vars) bool_vars.reduce(:|) end def self.pairwise_amo(bool_vars) bool_vars.combination(2).map do |e| e.map(&:~@).reduce(:|) end.reduce(:&) end def self.commander_amo(bool_vars) m = bool_vars.size / 2 introductory_variables = [] formula = Ravensat::InitialNode.new bool_vars.each_slice(2) do |e| c = Ravensat::VarNode.new subset = e << ~c formula &= pairwise_amo(subset) formula &= alo(subset) introductory_variables << c end if m < 6 formula &= pairwise_amo(introductory_variables) else formula &= commander_amo(introductory_variables) end end def self.all_different(*int_vars) int_vars.combination(2).map do |int_var| int_var.reduce(:!=) end.reduce(:&) end def self.all_only_one(*int_vars) int_vars.map(&:only_one).reduce(:&) end # alias :amo :pairwise_amo end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ravensat-0.3.2 | lib/ravensat/claw.rb |