ravensat 1.0.3 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 430c194a8bc6d59ba234e117839a244c0ee4bb61b507615b1a12b1d52609013c
4
- data.tar.gz: e2090935ff06835501061059e47156889e13bc9afe7c3a57746958afe6c4abb0
3
+ metadata.gz: c1c1d5979a19db3adbe7a8541d669ace60880845f7ed0e399f915392102757b9
4
+ data.tar.gz: 3829e433c926fb89b6b75743301926b1aca1d9e411fed63e91757464d4601a81
5
5
  SHA512:
6
- metadata.gz: 5500d691a90e8153d994db9c9fb0f5e4c0729232820fb41b7b6ddf1726a95090a783cf09c272e9459d139b2693effccb1c3e7e55625d15e269fc0595b5235327
7
- data.tar.gz: 2e9f44f44ef99640f370eb2329059438670b84e743729e8d4eaa19d585cc02bab17d506c45324971b2034cba7a41af890081f03803ebb7155fafced6d5c5725f
6
+ metadata.gz: 4f202c5196a0c611e965675341adcb889700814d0b80883a7adfecd86c10ce278f200afe0f99c4cf859a247391e60767c59f91b64aee7420ca33c42a03cd6455
7
+ data.tar.gz: e73fce1a7eb44ae778099cffba247f85b832f87ee4a602299800e474fe0d76fedb76267d31caa26314a9fa93d68d1976f34b2d0c9095fa0b390ec7b13ccf4305
data/lib/ravensat/claw.rb CHANGED
@@ -1,10 +1,26 @@
1
1
  module Ravensat
2
2
  module Claw
3
3
  def self.alo(bool_vars)
4
+ return bool_vars.first if bool_vars.size == 1
4
5
  bool_vars.reduce(:|)
5
6
  end
6
7
 
8
+ def self.at_most_k(bool_vars, k)
9
+ return bool_vars.first if bool_vars.size == 1
10
+ bool_vars.combination(k+1).map do |e|
11
+ e.map(&:~@).reduce(:|)
12
+ end.reduce(:&)
13
+ end
14
+
15
+ def self.at_least_k(bool_vars, k)
16
+ return bool_vars.first if bool_vars.size == 1
17
+ bool_vars.combination(k-1).map do |e|
18
+ alo(bool_vars - e)
19
+ end.reduce(:&)
20
+ end
21
+
7
22
  def self.pairwise_amo(bool_vars)
23
+ return bool_vars.first if bool_vars.size == 1
8
24
  bool_vars.combination(2).map do |e|
9
25
  e.map(&:~@).reduce(:|)
10
26
  end.reduce(:&)
@@ -12,6 +28,8 @@ module Ravensat
12
28
 
13
29
  # NOTE: Klieber, W. and Kwon, G.: Efficient CNF Encoding for Selecting 1 from N Objects (2007).
14
30
  def self.commander_amo(bool_vars)
31
+ return bool_vars.first if bool_vars.size == 1
32
+ # XXX: Operator unknown if bool_vars.size is very small.
15
33
  m = bool_vars.size / 2
16
34
  commander_variables = []
17
35
  formula = Ravensat::InitialNode.new
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ravensat
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ravensat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - rikuto matsuda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-18 00:00:00.000000000 Z
11
+ date: 2022-08-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: