gecoder-with-gecode 0.9.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. data/CHANGES +137 -0
  2. data/COPYING +17 -0
  3. data/LGPL-LICENSE +458 -0
  4. data/README +58 -0
  5. data/Rakefile +14 -0
  6. data/example/equation_system.rb +15 -0
  7. data/example/example_helper.rb +1 -0
  8. data/example/magic_sequence.rb +43 -0
  9. data/example/money.rb +36 -0
  10. data/example/queens.rb +42 -0
  11. data/example/send_more_money.rb +43 -0
  12. data/example/send_most_money.rb +58 -0
  13. data/example/square_tiling.rb +84 -0
  14. data/example/sudoku-set.rb +106 -0
  15. data/example/sudoku.rb +56 -0
  16. data/lib/gecode.dll +0 -0
  17. data/lib/gecoder.rb +5 -0
  18. data/lib/gecoder/bindings.rb +96 -0
  19. data/lib/gecoder/bindings/bindings.rb +2029 -0
  20. data/lib/gecoder/interface.rb +9 -0
  21. data/lib/gecoder/interface/binding_changes.rb +9 -0
  22. data/lib/gecoder/interface/branch.rb +163 -0
  23. data/lib/gecoder/interface/constraints.rb +471 -0
  24. data/lib/gecoder/interface/constraints/bool/boolean.rb +251 -0
  25. data/lib/gecoder/interface/constraints/bool/channel.rb +7 -0
  26. data/lib/gecoder/interface/constraints/bool/linear.rb +200 -0
  27. data/lib/gecoder/interface/constraints/bool_enum/channel.rb +68 -0
  28. data/lib/gecoder/interface/constraints/bool_enum/extensional.rb +106 -0
  29. data/lib/gecoder/interface/constraints/bool_enum/relation.rb +55 -0
  30. data/lib/gecoder/interface/constraints/bool_enum_constraints.rb +84 -0
  31. data/lib/gecoder/interface/constraints/bool_var_constraints.rb +155 -0
  32. data/lib/gecoder/interface/constraints/extensional_regexp.rb +101 -0
  33. data/lib/gecoder/interface/constraints/fixnum_enum/element.rb +63 -0
  34. data/lib/gecoder/interface/constraints/fixnum_enum/operation.rb +65 -0
  35. data/lib/gecoder/interface/constraints/fixnum_enum_constraints.rb +42 -0
  36. data/lib/gecoder/interface/constraints/int/arithmetic.rb +150 -0
  37. data/lib/gecoder/interface/constraints/int/channel.rb +51 -0
  38. data/lib/gecoder/interface/constraints/int/domain.rb +80 -0
  39. data/lib/gecoder/interface/constraints/int/linear.rb +143 -0
  40. data/lib/gecoder/interface/constraints/int/relation.rb +141 -0
  41. data/lib/gecoder/interface/constraints/int_enum/arithmetic.rb +63 -0
  42. data/lib/gecoder/interface/constraints/int_enum/channel.rb +86 -0
  43. data/lib/gecoder/interface/constraints/int_enum/count.rb +66 -0
  44. data/lib/gecoder/interface/constraints/int_enum/distinct.rb +64 -0
  45. data/lib/gecoder/interface/constraints/int_enum/element.rb +64 -0
  46. data/lib/gecoder/interface/constraints/int_enum/equality.rb +37 -0
  47. data/lib/gecoder/interface/constraints/int_enum/extensional.rb +187 -0
  48. data/lib/gecoder/interface/constraints/int_enum/sort.rb +135 -0
  49. data/lib/gecoder/interface/constraints/int_enum_constraints.rb +95 -0
  50. data/lib/gecoder/interface/constraints/int_var_constraints.rb +230 -0
  51. data/lib/gecoder/interface/constraints/reifiable_constraints.rb +78 -0
  52. data/lib/gecoder/interface/constraints/selected_set/select.rb +120 -0
  53. data/lib/gecoder/interface/constraints/selected_set_constraints.rb +75 -0
  54. data/lib/gecoder/interface/constraints/set/cardinality.rb +65 -0
  55. data/lib/gecoder/interface/constraints/set/channel.rb +51 -0
  56. data/lib/gecoder/interface/constraints/set/connection.rb +130 -0
  57. data/lib/gecoder/interface/constraints/set/domain.rb +156 -0
  58. data/lib/gecoder/interface/constraints/set/include.rb +36 -0
  59. data/lib/gecoder/interface/constraints/set/operation.rb +118 -0
  60. data/lib/gecoder/interface/constraints/set/relation.rb +155 -0
  61. data/lib/gecoder/interface/constraints/set_elements/relation.rb +116 -0
  62. data/lib/gecoder/interface/constraints/set_elements_constraints.rb +97 -0
  63. data/lib/gecoder/interface/constraints/set_enum/channel.rb +45 -0
  64. data/lib/gecoder/interface/constraints/set_enum/distinct.rb +43 -0
  65. data/lib/gecoder/interface/constraints/set_enum/operation.rb +69 -0
  66. data/lib/gecoder/interface/constraints/set_enum/select.rb +79 -0
  67. data/lib/gecoder/interface/constraints/set_enum_constraints.rb +84 -0
  68. data/lib/gecoder/interface/constraints/set_var_constraints.rb +243 -0
  69. data/lib/gecoder/interface/enum_matrix.rb +64 -0
  70. data/lib/gecoder/interface/enum_wrapper.rb +205 -0
  71. data/lib/gecoder/interface/model.rb +453 -0
  72. data/lib/gecoder/interface/model_sugar.rb +84 -0
  73. data/lib/gecoder/interface/search.rb +197 -0
  74. data/lib/gecoder/interface/variables.rb +306 -0
  75. data/lib/gecoder/version.rb +4 -0
  76. data/specs/bool_var.rb +81 -0
  77. data/specs/branch.rb +185 -0
  78. data/specs/constraints/bool/boolean.rb +317 -0
  79. data/specs/constraints/bool/boolean_properties.rb +51 -0
  80. data/specs/constraints/bool/linear.rb +213 -0
  81. data/specs/constraints/bool_enum/bool_enum_relation.rb +117 -0
  82. data/specs/constraints/bool_enum/channel.rb +102 -0
  83. data/specs/constraints/bool_enum/extensional.rb +225 -0
  84. data/specs/constraints/constraint_helper.rb +234 -0
  85. data/specs/constraints/constraint_receivers.rb +103 -0
  86. data/specs/constraints/constraints.rb +26 -0
  87. data/specs/constraints/fixnum_enum/element.rb +58 -0
  88. data/specs/constraints/fixnum_enum/operation.rb +67 -0
  89. data/specs/constraints/int/arithmetic.rb +149 -0
  90. data/specs/constraints/int/channel.rb +101 -0
  91. data/specs/constraints/int/domain.rb +106 -0
  92. data/specs/constraints/int/linear.rb +183 -0
  93. data/specs/constraints/int/linear_properties.rb +97 -0
  94. data/specs/constraints/int/relation.rb +84 -0
  95. data/specs/constraints/int_enum/arithmetic.rb +72 -0
  96. data/specs/constraints/int_enum/channel.rb +57 -0
  97. data/specs/constraints/int_enum/count.rb +72 -0
  98. data/specs/constraints/int_enum/distinct.rb +80 -0
  99. data/specs/constraints/int_enum/element.rb +61 -0
  100. data/specs/constraints/int_enum/equality.rb +29 -0
  101. data/specs/constraints/int_enum/extensional.rb +224 -0
  102. data/specs/constraints/int_enum/sort.rb +167 -0
  103. data/specs/constraints/operands.rb +264 -0
  104. data/specs/constraints/property_helper.rb +443 -0
  105. data/specs/constraints/reification_sugar.rb +69 -0
  106. data/specs/constraints/selected_set/select.rb +56 -0
  107. data/specs/constraints/selected_set/select_properties.rb +157 -0
  108. data/specs/constraints/set/cardinality.rb +58 -0
  109. data/specs/constraints/set/cardinality_properties.rb +46 -0
  110. data/specs/constraints/set/channel.rb +77 -0
  111. data/specs/constraints/set/connection.rb +176 -0
  112. data/specs/constraints/set/domain.rb +197 -0
  113. data/specs/constraints/set/include.rb +36 -0
  114. data/specs/constraints/set/operation.rb +132 -0
  115. data/specs/constraints/set/relation.rb +117 -0
  116. data/specs/constraints/set_elements/relation.rb +84 -0
  117. data/specs/constraints/set_enum/channel.rb +80 -0
  118. data/specs/constraints/set_enum/distinct.rb +59 -0
  119. data/specs/constraints/set_enum/operation.rb +111 -0
  120. data/specs/constraints/set_enum/select.rb +73 -0
  121. data/specs/distribution.rb +14 -0
  122. data/specs/enum_matrix.rb +43 -0
  123. data/specs/enum_wrapper.rb +179 -0
  124. data/specs/examples.rb +17 -0
  125. data/specs/int_var.rb +163 -0
  126. data/specs/logging.rb +24 -0
  127. data/specs/model.rb +325 -0
  128. data/specs/model_sugar.rb +30 -0
  129. data/specs/search.rb +383 -0
  130. data/specs/selected_set.rb +39 -0
  131. data/specs/set_elements.rb +34 -0
  132. data/specs/set_var.rb +82 -0
  133. data/specs/spec_helper.rb +265 -0
  134. data/tasks/all_tasks.rb +1 -0
  135. data/tasks/dependencies.txt +22 -0
  136. data/tasks/distribution.rake +194 -0
  137. data/tasks/rcov.rake +18 -0
  138. data/tasks/specs.rake +21 -0
  139. data/tasks/svn.rake +16 -0
  140. data/tasks/website.rake +51 -0
  141. data/vendor/gecode/win32/lib/libgecodeint.dll +0 -0
  142. data/vendor/gecode/win32/lib/libgecodekernel.dll +0 -0
  143. data/vendor/gecode/win32/lib/libgecodeminimodel.dll +0 -0
  144. data/vendor/gecode/win32/lib/libgecodesearch.dll +0 -0
  145. data/vendor/gecode/win32/lib/libgecodeset.dll +0 -0
  146. data/vendor/gecode/win32/lib/libgecodesupport.dll +0 -0
  147. data/vendor/rust/README +28 -0
  148. data/vendor/rust/bin/cxxgenerator.rb +93 -0
  149. data/vendor/rust/include/rust_checks.hh +116 -0
  150. data/vendor/rust/include/rust_conversions.hh +102 -0
  151. data/vendor/rust/rust.rb +67 -0
  152. data/vendor/rust/rust/attribute.rb +51 -0
  153. data/vendor/rust/rust/bindings.rb +172 -0
  154. data/vendor/rust/rust/class.rb +337 -0
  155. data/vendor/rust/rust/constants.rb +48 -0
  156. data/vendor/rust/rust/container.rb +110 -0
  157. data/vendor/rust/rust/cppifaceparser.rb +129 -0
  158. data/vendor/rust/rust/cwrapper.rb +72 -0
  159. data/vendor/rust/rust/cxxclass.rb +96 -0
  160. data/vendor/rust/rust/element.rb +81 -0
  161. data/vendor/rust/rust/enum.rb +63 -0
  162. data/vendor/rust/rust/function.rb +407 -0
  163. data/vendor/rust/rust/namespace.rb +61 -0
  164. data/vendor/rust/rust/templates/AttributeDefinition.rusttpl +17 -0
  165. data/vendor/rust/rust/templates/AttributeInitBinding.rusttpl +9 -0
  166. data/vendor/rust/rust/templates/BindingsHeader.rusttpl +24 -0
  167. data/vendor/rust/rust/templates/BindingsUnit.rusttpl +46 -0
  168. data/vendor/rust/rust/templates/CWrapperClassDefinitions.rusttpl +64 -0
  169. data/vendor/rust/rust/templates/ClassDeclarations.rusttpl +7 -0
  170. data/vendor/rust/rust/templates/ClassInitialize.rusttpl +6 -0
  171. data/vendor/rust/rust/templates/ConstructorStub.rusttpl +21 -0
  172. data/vendor/rust/rust/templates/CxxClassDefinitions.rusttpl +100 -0
  173. data/vendor/rust/rust/templates/CxxMethodStub.rusttpl +12 -0
  174. data/vendor/rust/rust/templates/CxxStandaloneClassDefinitions.rusttpl +26 -0
  175. data/vendor/rust/rust/templates/EnumDeclarations.rusttpl +3 -0
  176. data/vendor/rust/rust/templates/EnumDefinitions.rusttpl +29 -0
  177. data/vendor/rust/rust/templates/FunctionDefinition.rusttpl +9 -0
  178. data/vendor/rust/rust/templates/FunctionInitAlias.rusttpl +5 -0
  179. data/vendor/rust/rust/templates/FunctionInitBinding.rusttpl +9 -0
  180. data/vendor/rust/rust/templates/MethodInitBinding.rusttpl +9 -0
  181. data/vendor/rust/rust/templates/ModuleDeclarations.rusttpl +3 -0
  182. data/vendor/rust/rust/templates/ModuleDefinitions.rusttpl +3 -0
  183. data/vendor/rust/rust/templates/StandaloneClassDeclarations.rusttpl +7 -0
  184. data/vendor/rust/rust/templates/VariableFunctionCall.rusttpl +14 -0
  185. data/vendor/rust/rust/type.rb +98 -0
  186. data/vendor/rust/test/Makefile +4 -0
  187. data/vendor/rust/test/constants.rb +36 -0
  188. data/vendor/rust/test/cppclass.cc +45 -0
  189. data/vendor/rust/test/cppclass.hh +67 -0
  190. data/vendor/rust/test/cppclass.rb +59 -0
  191. data/vendor/rust/test/cwrapper.c +74 -0
  192. data/vendor/rust/test/cwrapper.h +41 -0
  193. data/vendor/rust/test/cwrapper.rb +56 -0
  194. data/vendor/rust/test/dummyclass.hh +31 -0
  195. data/vendor/rust/test/lib/extension-test.rb +98 -0
  196. data/vendor/rust/test/operators.cc +41 -0
  197. data/vendor/rust/test/operators.hh +39 -0
  198. data/vendor/rust/test/operators.rb +39 -0
  199. data/vendor/rust/test/test-constants.rb +43 -0
  200. data/vendor/rust/test/test-cppclass.rb +82 -0
  201. data/vendor/rust/test/test-cwrapper.rb +80 -0
  202. data/vendor/rust/test/test-operators.rb +42 -0
  203. metadata +393 -0
data/example/sudoku.rb ADDED
@@ -0,0 +1,56 @@
1
+ require File.dirname(__FILE__) + '/example_helper'
2
+ require 'enumerator'
3
+
4
+ # Solves the sudoku problem: http://en.wikipedia.org/wiki/Soduko
5
+
6
+ # The sudoku we want to solve (0 represents that the square is empty).
7
+ sudoku = Matrix[
8
+ [0,0,0, 2,0,5, 0,0,0],
9
+ [0,9,0, 0,0,0, 7,3,0],
10
+ [0,0,2, 0,0,9, 0,6,0],
11
+
12
+ [2,0,0, 0,0,0, 4,0,9],
13
+ [0,0,0, 0,7,0, 0,0,0],
14
+ [6,0,9, 0,0,0, 0,0,1],
15
+
16
+ [0,8,0, 4,0,0, 1,0,0],
17
+ [0,6,3, 0,0,0, 0,8,0],
18
+ [0,0,0, 6,0,8, 0,0,0]]
19
+
20
+ solution = Gecode.solve do
21
+ # Verify that the input is of a valid size.
22
+ @size = n = sudoku.row_size
23
+ sub_matrix_size = Math.sqrt(n).round
24
+ unless sudoku.square? and sub_matrix_size**2 == n
25
+ raise ArgumentError, 'Incorrect value matrix size.'
26
+ end
27
+ sub_count = sub_matrix_size
28
+
29
+ # Create the squares and initialize them.
30
+ squares_is_an int_var_matrix(n, n, 1..n)
31
+ sudoku.row_size.times do |i|
32
+ sudoku.column_size.times do |j|
33
+ squares[i,j].must == sudoku[i,j] unless sudoku[i,j] == 0
34
+ end
35
+ end
36
+
37
+ # Constraints.
38
+ n.times do |i|
39
+ # All rows must contain distinct numbers.
40
+ squares.row(i).must_be.distinct(:strength => :domain)
41
+ # All columns must contain distinct numbers.
42
+ squares.column(i).must_be.distinct(:strength => :domain)
43
+ # All sub-matrices must contain distinct numbers.
44
+ squares.minor(
45
+ (i % sub_count) * sub_matrix_size,
46
+ sub_matrix_size,
47
+ (i / sub_count) * sub_matrix_size,
48
+ sub_matrix_size).must_be.distinct(:strength => :domain)
49
+ end
50
+
51
+ # Branching, we use first-fail heuristic.
52
+ branch_on squares, :variable => :smallest_size, :value => :min
53
+ end.squares.values
54
+
55
+ # Output the solved sudoku in a grid.
56
+ puts solution.enum_slice(sudoku.row_size).map{ |slice| slice.join(' ') }.join($/)
data/lib/gecode.dll ADDED
Binary file
data/lib/gecoder.rb ADDED
@@ -0,0 +1,5 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__))
2
+
3
+ require 'gecoder/version'
4
+ require 'gecoder/bindings'
5
+ require 'gecoder/interface'
@@ -0,0 +1,96 @@
1
+ # Problems can be formulated and solved either through defining a new
2
+ # class that inherits from Gecode::Model or by using Gecode#solve et al.
3
+ # Gecode::Model describes how to formulate problems.
4
+ #
5
+ # ==== Examples
6
+ #
7
+ # The following two examples show how to solve the following equation
8
+ # system, using both ways to define and solve a problem.
9
+ #
10
+ # Equation system:
11
+ # x + y = z
12
+ # x = y - 3
13
+ # 0 <= x,y,z <= 9
14
+ #
15
+ # === Inheriting from Gecode::Model
16
+ #
17
+ # class EquationProblem < Gecode::Model
18
+ # def initialize
19
+ # variables_is_an int_var_array(3, 0..9)
20
+ # x, y, z = variables
21
+ #
22
+ # (x + y).must == z
23
+ # x.must == y - 3
24
+ #
25
+ # branch_on variables
26
+ # end
27
+ # end
28
+ # puts EquationProblem.new.solve!.variables.join(' ')
29
+ #
30
+ # === Using Gecode#solve
31
+ #
32
+ # solution = Gecode.solve do
33
+ # variables_is_an int_var_array(3, 0..9)
34
+ # x, y, z = variables
35
+ #
36
+ # (x + y).must == z
37
+ # x.must == y - 3
38
+ #
39
+ # branch_on variables
40
+ # end
41
+ # puts solution.variables.values.join(' ')
42
+ #
43
+ module Gecode
44
+ # Loads the binding libraries. This is done as a method in order to be easier
45
+ # to test.
46
+ def self.load_bindings_lib #:nodoc:
47
+ # Workaround to get the precompiled DLLs into the DLL search path on
48
+ # Windows.
49
+ dll_dir = File.dirname(__FILE__) + '/../../vendor/gecode/win32/lib'
50
+ if RUBY_PLATFORM =~ /mswin/ and File.exists? dll_dir
51
+ # Switch directory while loading libraries so that the DLLs are in the
52
+ # work directory.
53
+ require 'fileutils'
54
+ FileUtils.cd dll_dir do
55
+ require 'gecode'
56
+ end
57
+ else
58
+ require 'gecode'
59
+ end
60
+ end
61
+
62
+ # Load the bindings library.
63
+ load_bindings_lib
64
+
65
+ # The Gecode::Raw module is what the interface should use to access methods
66
+ # in Gecode. The actual bindings are located in ::GecodeRaw.
67
+
68
+ # Describes a layer that delegates to GecodeRaw only after having logged the
69
+ # call.
70
+ module LoggingLayer #:nodoc:
71
+ require 'logger'
72
+
73
+ def self.method_missing(name, *args)
74
+ logger.info{ "#{name}(#{args.join(', ')})" }
75
+ ::GecodeRaw.send(name, *args)
76
+ end
77
+
78
+ def self.const_missing(name)
79
+ ::GecodeRaw.const_get(name)
80
+ end
81
+
82
+ # Gets the logger, or creates one if none exists.
83
+ def self.logger
84
+ return @logger unless @logger.nil?
85
+ file = open('gecoder.log', File::WRONLY | File::APPEND | File::CREAT)
86
+ @logger = ::Logger.new(file)
87
+ @logger.datetime_format = "%Y-%m-%d %H:%M:%S"
88
+ @logger
89
+ end
90
+ end
91
+
92
+ # We just make Gecode::Raw an alias of the real module.
93
+ Raw = ::GecodeRaw
94
+ # Log all calls via Gecode::Raw.
95
+ #Raw = LoggingLayer
96
+ end
@@ -0,0 +1,2029 @@
1
+ # Copyright (c) 2007, David Cuadrado <krawek@gmail.com>
2
+ # All rights reserved.
3
+
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # 1. Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright
10
+ # notice, this list of conditions and the following disclaimer in the
11
+ # documentation and/or other materials provided with the distribution.
12
+ #
13
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
17
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23
+ # POSSIBILITY OF SUCH DAMAGE.
24
+
25
+
26
+ RUST_PATH = File.dirname(__FILE__) + '/../../../vendor/rust'
27
+ $:.unshift(RUST_PATH) unless $:.include?(RUST_PATH)
28
+ require 'rust'
29
+
30
+ ruby2intargs = %@
31
+
32
+ bool is_Gecode_IntArgs(VALUE arr)
33
+ {
34
+ return is_array(arr);
35
+ }
36
+
37
+ Gecode::IntArgs ruby2Gecode_IntArgs(VALUE arr, int argn = -1);
38
+ Gecode::IntArgs ruby2Gecode_IntArgs(VALUE arr, int argn)
39
+ {
40
+ RArray *array = RARRAY(arr);
41
+ Gecode::IntArgs intargs(array->len);
42
+ for(int i = 0; i < array->len; i++)
43
+ {
44
+ intargs[i] = NUM2INT(array->ptr[i]);
45
+ }
46
+
47
+ return intargs;
48
+ }
49
+ @
50
+
51
+ custom_mark_definitions =<<-"end_custom_definition"
52
+ static void Gecode_MSpace_custom_mark(void *p) {
53
+ Gecode_MSpace_mark(p);
54
+ ((Gecode::MSpace*)p)->gc_mark();
55
+ }
56
+
57
+ static void Gecode_MIntVarArray_custom_mark(void *p) {
58
+ Gecode_MIntVarArray_mark(p);
59
+ ((Gecode::MIntVarArray*)p)->gc_mark();
60
+ }
61
+
62
+ static void Gecode_MBoolVarArray_custom_mark(void *p) {
63
+ Gecode_MBoolVarArray_mark(p);
64
+ ((Gecode::MBoolVarArray*)p)->gc_mark();
65
+ }
66
+
67
+ static void Gecode_MSetVarArray_custom_mark(void *p) {
68
+ Gecode_MSetVarArray_mark(p);
69
+ ((Gecode::MSetVarArray*)p)->gc_mark();
70
+ }
71
+ end_custom_definition
72
+
73
+
74
+ Rust::Bindings::create_bindings Rust::Bindings::LangCxx, "gecode" do |b|
75
+ b.include_header 'gecode/kernel.hh', Rust::Bindings::HeaderGlobal
76
+ b.include_header 'gecode/int.hh', Rust::Bindings::HeaderGlobal
77
+ b.include_header 'gecode/set.hh', Rust::Bindings::HeaderGlobal
78
+ b.include_header 'gecode/search.hh', Rust::Bindings::HeaderGlobal
79
+ b.include_header 'gecode/minimodel.hh', Rust::Bindings::HeaderGlobal
80
+ b.include_header 'gecoder.h', Rust::Bindings::HeaderLocal
81
+
82
+ b.add_custom_definition ruby2intargs
83
+ b.add_custom_definition custom_mark_definitions
84
+
85
+ # Is it possible to use namespaces with multiple levels in Rust? I.e. use
86
+ # Gecode::Raw instead of GecodeRaw here (and avoid the hidious renaming)
87
+ # when requiring them.
88
+ b.add_namespace "GecodeRaw", "Gecode" do |ns|
89
+ ns.add_enum "IntVarBranch" do |enum|
90
+ enum.add_value "INT_VAR_NONE"
91
+ enum.add_value "INT_VAR_MIN_MIN"
92
+ enum.add_value "INT_VAR_MIN_MAX"
93
+ enum.add_value "INT_VAR_MAX_MIN"
94
+ enum.add_value "INT_VAR_MAX_MAX"
95
+ enum.add_value "INT_VAR_SIZE_MIN"
96
+ enum.add_value "INT_VAR_SIZE_MAX"
97
+ enum.add_value "INT_VAR_DEGREE_MAX"
98
+ enum.add_value "INT_VAR_DEGREE_MIN"
99
+ enum.add_value "INT_VAR_REGRET_MIN_MIN"
100
+ enum.add_value "INT_VAR_REGRET_MIN_MAX"
101
+ enum.add_value "INT_VAR_REGRET_MAX_MIN"
102
+ enum.add_value "INT_VAR_REGRET_MAX_MAX"
103
+ end
104
+
105
+ ns.add_enum "IntValBranch" do |enum|
106
+ enum.add_value "INT_VAL_MIN"
107
+ enum.add_value "INT_VAL_MED"
108
+ enum.add_value "INT_VAL_MAX"
109
+ enum.add_value "INT_VAL_SPLIT_MIN"
110
+ enum.add_value "INT_VAL_SPLIT_MAX"
111
+ end
112
+
113
+ ns.add_enum "SetVarBranch" do |enum|
114
+ enum.add_value "SET_VAR_NONE"
115
+ enum.add_value "SET_VAR_MIN_CARD"
116
+ enum.add_value "SET_VAR_MAX_CARD"
117
+ enum.add_value "SET_VAR_MIN_UNKNOWN_ELEM"
118
+ enum.add_value "SET_VAR_MAX_UNKNOWN_ELEM"
119
+ end
120
+
121
+ ns.add_enum "SetValBranch" do |enum|
122
+ enum.add_value "SET_VAL_MIN"
123
+ enum.add_value "SET_VAL_MAX"
124
+ end
125
+
126
+ ns.add_enum "IntRelType" do |enum|
127
+ enum.add_value "IRT_EQ"
128
+ enum.add_value "IRT_NQ"
129
+ enum.add_value "IRT_LQ"
130
+ enum.add_value "IRT_LE"
131
+ enum.add_value "IRT_GQ"
132
+ enum.add_value "IRT_GR"
133
+ end
134
+
135
+ ns.add_enum "BoolOpType" do |enum|
136
+ enum.add_value "BOT_AND"
137
+ enum.add_value "BOT_OR"
138
+ enum.add_value "BOT_IMP"
139
+ enum.add_value "BOT_EQV"
140
+ enum.add_value "BOT_XOR"
141
+ end
142
+
143
+ ns.add_enum "SetRelType" do |enum|
144
+ enum.add_value "SRT_EQ"
145
+ enum.add_value "SRT_NQ"
146
+ enum.add_value "SRT_SUB"
147
+ enum.add_value "SRT_SUP"
148
+ enum.add_value "SRT_DISJ"
149
+ enum.add_value "SRT_CMPL"
150
+ end
151
+
152
+ ns.add_enum "SetOpType" do |enum|
153
+ enum.add_value "SOT_UNION"
154
+ enum.add_value "SOT_DUNION"
155
+ enum.add_value "SOT_INTER"
156
+ enum.add_value "SOT_MINUS"
157
+ end
158
+
159
+ ns.add_enum "IntConLevel" do |enum|
160
+ enum.add_value "ICL_VAL"
161
+ enum.add_value "ICL_BND"
162
+ enum.add_value "ICL_DOM"
163
+ enum.add_value "ICL_DEF"
164
+ end
165
+
166
+ ns.add_enum "PropKind" do |enum|
167
+ enum.add_value "PK_DEF"
168
+ enum.add_value "PK_SPEED"
169
+ enum.add_value "PK_MEMORY"
170
+ end
171
+
172
+ ns.add_enum "SpaceStatus" do |enum|
173
+ enum.add_value "SS_FAILED"
174
+ enum.add_value "SS_SOLVED"
175
+ enum.add_value "SS_BRANCH"
176
+ end
177
+
178
+ ns.add_enum "IntAssign" do |enum|
179
+ enum.add_value "INT_ASSIGN_MIN"
180
+ enum.add_value "INT_ASSIGN_MED"
181
+ enum.add_value "INT_ASSIGN_MAX"
182
+ end
183
+
184
+ ns.add_cxx_class "MIntVarArray" do |klass|
185
+ klass.bindname = "IntVarArray"
186
+ klass.function_mark = 'Gecode_MIntVarArray_custom_mark'
187
+
188
+ klass.add_constructor
189
+ klass.add_constructor do |func|
190
+ func.add_parameter "Gecode::MSpace *", "home"
191
+ func.add_parameter "int", "n"
192
+ end
193
+
194
+ klass.add_constructor do |func|
195
+ func.add_parameter "Gecode::MSpace *", "home"
196
+ func.add_parameter "int", "n"
197
+ func.add_parameter "int", "min"
198
+ func.add_parameter "int", "max"
199
+ end
200
+
201
+ klass.add_constructor do |func|
202
+ func.add_parameter "Gecode::MSpace *", "home"
203
+ func.add_parameter "int", "n"
204
+ func.add_parameter "Gecode::IntSet", "s"
205
+ end
206
+
207
+ klass.add_method "at", "Gecode::IntVar&" do |method|
208
+ method.add_parameter "int", "index"
209
+ end
210
+
211
+ klass.add_operator "[]", "Gecode::IntVar&" do |method|
212
+ method.add_parameter "int", "index"
213
+ end
214
+
215
+ klass.add_operator "[]=", "Gecode::IntVar&" do |method|
216
+ method.add_parameter "int", "index"
217
+ method.add_parameter "Gecode::IntVar", "val"
218
+ end
219
+
220
+ klass.add_method "enlargeArray" do |method|
221
+ method.add_parameter "Gecode::MSpace *", "home"
222
+ method.add_parameter "int", "n"
223
+ end
224
+
225
+ klass.add_method "size", "int"
226
+
227
+ klass.add_method "debug"
228
+
229
+ end
230
+
231
+
232
+ ns.add_cxx_class "MBoolVarArray" do |klass|
233
+ klass.bindname = "BoolVarArray"
234
+ klass.function_mark = 'Gecode_MBoolVarArray_custom_mark'
235
+
236
+ klass.add_constructor
237
+ klass.add_constructor do |func|
238
+ func.add_parameter "Gecode::MSpace *", "home"
239
+ func.add_parameter "int", "n"
240
+ end
241
+
242
+ klass.add_method "at", "Gecode::BoolVar&" do |method|
243
+ method.add_parameter "int", "index"
244
+ end
245
+
246
+ klass.add_operator "[]", "Gecode::BoolVar&" do |method|
247
+ method.add_parameter "int", "index"
248
+ end
249
+
250
+ klass.add_operator "[]=", "Gecode::BoolVar&" do |method|
251
+ method.add_parameter "int", "index"
252
+ method.add_parameter "Gecode::BoolVar", "val"
253
+ end
254
+
255
+ klass.add_method "enlargeArray" do |method|
256
+ method.add_parameter "Gecode::MSpace *", "home"
257
+ method.add_parameter "int", "n"
258
+ end
259
+
260
+ klass.add_method "size", "int"
261
+
262
+ klass.add_method "debug"
263
+
264
+ end
265
+
266
+ ns.add_cxx_class "MSetVarArray" do |klass|
267
+ klass.bindname = "SetVarArray"
268
+ klass.function_mark = 'Gecode_MSetVarArray_custom_mark'
269
+
270
+ klass.add_constructor
271
+
272
+ klass.add_constructor do |method|
273
+ method.add_parameter "Gecode::MSpace *", "home"
274
+ method.add_parameter "int", "n"
275
+ end
276
+
277
+ klass.add_constructor do |method|
278
+ method.add_parameter "Gecode::MSpace *", "home"
279
+ method.add_parameter "int", "n"
280
+ method.add_parameter "int", "glbMin"
281
+ method.add_parameter "int", "glbMax"
282
+ method.add_parameter "int", "lubMin"
283
+ method.add_parameter "int", "lubMax"
284
+ method.add_parameter "int", "minCard"
285
+ method.add_parameter "int", "maxCard"
286
+ end
287
+
288
+ klass.add_constructor do |method|
289
+ method.add_parameter "Gecode::MSpace *", "home"
290
+ method.add_parameter "int", "n"
291
+ method.add_parameter "Gecode::IntSet", "glb"
292
+ method.add_parameter "int", "lubMin"
293
+ method.add_parameter "int", "lubMax"
294
+ method.add_parameter "int", "minCard", true
295
+ method.add_parameter "int", "maxCard", true
296
+ end
297
+
298
+ klass.add_constructor do |method|
299
+ method.add_parameter "Gecode::MSpace *", "home"
300
+ method.add_parameter "int", "n"
301
+ method.add_parameter "int", "glbMin"
302
+ method.add_parameter "int", "glbMax"
303
+ method.add_parameter "Gecode::IntSet", "lub"
304
+ method.add_parameter "int", "minCard", true
305
+ method.add_parameter "int", "maxCard", true
306
+ end
307
+
308
+ klass.add_constructor do |method|
309
+ method.add_parameter "Gecode::MSpace *", "home"
310
+ method.add_parameter "int", "n"
311
+ method.add_parameter "Gecode::IntSet", "glb"
312
+ method.add_parameter "Gecode::IntSet", "lub"
313
+ method.add_parameter "int", "minCard", true
314
+ method.add_parameter "int", "maxCard", true
315
+ end
316
+
317
+ klass.add_method "at", "Gecode::SetVar&" do |method|
318
+ method.add_parameter "int", "index"
319
+ end
320
+
321
+ klass.add_operator "[]", "Gecode::SetVar&" do |method|
322
+ method.add_parameter "int", "index"
323
+ end
324
+
325
+ klass.add_operator "[]=", "Gecode::SetVar&" do |method|
326
+ method.add_parameter "int", "index"
327
+ method.add_parameter "Gecode::SetVar", "val"
328
+ end
329
+
330
+ klass.add_method "enlargeArray" do |method|
331
+ method.add_parameter "Gecode::MSpace *", "home"
332
+ method.add_parameter "int", "n"
333
+ end
334
+
335
+ klass.add_method "size", "int"
336
+
337
+ klass.add_method "debug"
338
+ end
339
+
340
+ ns.add_cxx_class "TupleSet" do |klass|
341
+ klass.add_constructor
342
+
343
+ klass.add_method "add" do |method|
344
+ method.add_parameter "Gecode::IntArgs", "tuple"
345
+ end
346
+
347
+ klass.add_method "finalize"
348
+
349
+ klass.add_method "finalized", "bool"
350
+
351
+ klass.add_method "tuples", "int"
352
+ end
353
+
354
+ ns.add_cxx_class "MSpace" do |klass|
355
+ klass.bindname = "Space"
356
+ klass.function_mark = 'Gecode_MSpace_custom_mark'
357
+
358
+ klass.add_constructor
359
+
360
+ klass.add_method "constrain" do |method|
361
+ method.add_parameter "Gecode::MSpace*", "s"
362
+ end
363
+
364
+ klass.add_method "new_int_var", "int" do |method|
365
+ method.add_parameter "int", "min"
366
+ method.add_parameter "int", "max"
367
+ end
368
+
369
+ klass.add_method "new_int_var", "int" do |method|
370
+ method.add_parameter "Gecode::IntSet", "domain"
371
+ end
372
+
373
+ klass.add_method "new_bool_var", "int" do |method|
374
+ end
375
+
376
+ klass.add_method "new_set_var", "int" do |method|
377
+ method.add_parameter "Gecode::IntSet", "glb"
378
+ method.add_parameter "Gecode::IntSet", "lub"
379
+ method.add_parameter "int", "cardMin"
380
+ method.add_parameter "int", "cardMax"
381
+ end
382
+
383
+ klass.add_method "int_var", "Gecode::IntVar*" do |method|
384
+ method.add_parameter "int", "id"
385
+ end
386
+
387
+ klass.add_method "bool_var", "Gecode::BoolVar*" do |method|
388
+ method.add_parameter "int", "id"
389
+ end
390
+
391
+ klass.add_method "set_var", "Gecode::SetVar*" do |method|
392
+ method.add_parameter "int", "id"
393
+ end
394
+
395
+ klass.add_method "clone", "Gecode::MSpace *" do |method|
396
+ method.add_parameter "bool", "shared"
397
+ end
398
+
399
+ klass.add_method "status", "int"
400
+
401
+ klass.add_method "propagators", "int"
402
+ klass.add_method "branchings", "int"
403
+ klass.add_method "failed", "bool"
404
+
405
+ # The description method is commented out because it overlaps with the
406
+ # description method used by rspec, and isn't used directly in the
407
+ # interface.
408
+ #klass.add_method "mdescription", "Gecode::MBranchingDesc *", "description"
409
+ end
410
+
411
+ # The namespace structure doesn't completely mimic Gecode's namespace
412
+ # structure. This is because there's apparently some limitation that
413
+ # prevents two namespaces from having the same name (Limits), regardless
414
+ # of if they have the same parent or not.
415
+ ns.add_namespace "IntLimits" do |limitsns|
416
+ limitsns.add_constant "MAX", "Gecode::Int::Limits::max"
417
+ limitsns.add_constant "MIN", "Gecode::Int::Limits::min"
418
+ end
419
+
420
+ ns.add_namespace "SetLimits" do |limitsns|
421
+ limitsns.add_constant "MAX", "Gecode::Set::Limits::max"
422
+ limitsns.add_constant "MIN", "Gecode::Set::Limits::min"
423
+ limitsns.add_constant "CARD", "Gecode::Set::Limits::card"
424
+ end
425
+
426
+ ns.add_cxx_class "IntSet" do |klass|
427
+ klass.add_constructor do |method|
428
+ method.add_parameter "int", "min"
429
+ method.add_parameter "int", "max"
430
+ end
431
+
432
+ klass.add_constructor do |method|
433
+ method.add_parameter "int []", "r"
434
+ method.add_parameter "int", "n"
435
+ end
436
+
437
+ klass.add_method "size", "int"
438
+
439
+ klass.add_method "width", "unsigned int" do |method|
440
+ method.add_parameter "int", "i"
441
+ end
442
+
443
+ klass.add_method "max", "int" do |method|
444
+ method.add_parameter "int", "i"
445
+ end
446
+
447
+ klass.add_method "min", "int" do |method|
448
+ method.add_parameter "int", "i"
449
+ end
450
+
451
+ klass.add_constant "Empty", "(Gecode::IntSet *)&Gecode::IntSet::empty"
452
+ end
453
+
454
+ ns.add_cxx_class "IntVar" do |klass|
455
+ klass.add_constructor do |method|
456
+ method.add_parameter "Gecode::MSpace*", "home"
457
+ method.add_parameter "int", "min"
458
+ method.add_parameter "int", "max"
459
+ end
460
+
461
+ klass.add_constructor do |method|
462
+ method.add_parameter "Gecode::MSpace*", "home"
463
+ method.add_parameter "Gecode::IntSet", "s"
464
+ end
465
+
466
+ klass.add_method "max", "int"
467
+
468
+ klass.add_method "min", "int"
469
+ klass.add_method "med", "int"
470
+ klass.add_method "val", "int"
471
+ klass.add_method "size", "unsigned int"
472
+ klass.add_method "width", "unsigned int"
473
+ klass.add_method "degree", "unsigned int"
474
+
475
+ klass.add_method "range", "bool"
476
+ klass.add_method "assigned", "bool"
477
+ klass.add_method "in", "bool" do |method|
478
+ method.add_parameter "int", "n"
479
+ end
480
+
481
+ klass.add_method "update" do |method|
482
+ method.add_parameter "Gecode::MSpace*", "home"
483
+ method.add_parameter "bool", "share"
484
+ method.add_parameter "Gecode::IntVar", "x"
485
+ end
486
+
487
+ klass.add_operator "+", "Gecode::MiniModel::LinExpr<Gecode::IntVar>" do |operator|
488
+ operator.add_parameter("int", "i")
489
+ end
490
+
491
+ klass.add_operator "-", "Gecode::MiniModel::LinExpr<Gecode::IntVar>" do |operator|
492
+ operator.add_parameter("int", "i")
493
+ end
494
+
495
+ klass.add_operator "*", "Gecode::MiniModel::LinExpr<Gecode::IntVar>" do |operator|
496
+ operator.add_parameter("int", "i")
497
+ end
498
+
499
+ klass.add_operator "!=", "Gecode::MiniModel::LinRel<Gecode::IntVar>", "different" do |operator|
500
+ operator.add_parameter("Gecode::IntVar", "other")
501
+ end
502
+
503
+ klass.add_operator "==", "Gecode::MiniModel::LinRel<Gecode::IntVar>", "equal" do |operator|
504
+ operator.add_parameter("Gecode::IntVar", "other")
505
+ end
506
+
507
+ end
508
+
509
+ ns.add_cxx_class "BoolVar" do |klass|
510
+ klass.add_constructor
511
+ klass.add_constructor do |method|
512
+ method.add_parameter "Gecode::MSpace*", "home"
513
+ method.add_parameter "int", "min"
514
+ method.add_parameter "int", "max"
515
+ end
516
+
517
+ klass.add_method "max", "int"
518
+
519
+ klass.add_method "min", "int"
520
+ klass.add_method "med", "int"
521
+ klass.add_method "val", "int"
522
+ klass.add_method "size", "unsigned int"
523
+ klass.add_method "width", "unsigned int"
524
+ klass.add_method "degree", "unsigned int"
525
+
526
+ klass.add_method "range", "bool"
527
+ klass.add_method "assigned", "bool"
528
+ klass.add_method "in", "bool" do |method|
529
+ method.add_parameter "int", "n"
530
+ end
531
+
532
+ klass.add_method "update", "void" do |method|
533
+ method.add_parameter "Gecode::MSpace*", "home"
534
+ method.add_parameter "bool", "share"
535
+ method.add_parameter "Gecode::BoolVar", "x"
536
+ end
537
+
538
+ klass.add_operator "+", "Gecode::MiniModel::LinExpr<Gecode::BoolVar>" do |operator|
539
+ operator.add_parameter("int", "i")
540
+ end
541
+
542
+ klass.add_operator "-", "Gecode::MiniModel::LinExpr<Gecode::BoolVar>" do |operator|
543
+ operator.add_parameter("int", "i")
544
+ end
545
+
546
+ klass.add_operator "*", "Gecode::MiniModel::LinExpr<Gecode::BoolVar>" do |operator|
547
+ operator.add_parameter("int", "i")
548
+ end
549
+
550
+ klass.add_operator "!=", "Gecode::MiniModel::LinRel<Gecode::BoolVar>", "different" do |operator|
551
+ operator.add_parameter("Gecode::BoolVar", "other")
552
+ end
553
+
554
+ klass.add_operator "==", "Gecode::MiniModel::LinRel<Gecode::BoolVar>", "equal" do |operator|
555
+ operator.add_parameter("Gecode::BoolVar", "other")
556
+ end
557
+ end
558
+
559
+ ns.add_cxx_class "SetVar" do |klass|
560
+ klass.add_constructor
561
+ klass.add_constructor do |method|
562
+ method.add_parameter "Gecode::MSpace*", "home"
563
+ end
564
+ klass.add_constructor do |method|
565
+ method.add_parameter "Gecode::MSpace*", "home"
566
+ method.add_parameter "int", "glbMin"
567
+ method.add_parameter "int", "glbMax"
568
+ method.add_parameter "int", "lubMin"
569
+ method.add_parameter "int", "lubMax"
570
+ method.add_parameter "int", "cardMin"
571
+ method.add_parameter "int", "cardMax"
572
+ end
573
+
574
+ klass.add_constructor do |method|
575
+ method.add_parameter "Gecode::MSpace*", "home"
576
+ method.add_parameter "Gecode::IntSet", "glbD"
577
+ method.add_parameter "int", "lubMin"
578
+ method.add_parameter "int", "lubMax"
579
+ method.add_parameter "int", "cardMin", true
580
+ method.add_parameter "int", "cardMax", true
581
+ end
582
+
583
+ klass.add_constructor do |method|
584
+ method.add_parameter "Gecode::MSpace*", "home"
585
+ method.add_parameter "int", "glbMin"
586
+ method.add_parameter "int", "glbMax"
587
+ method.add_parameter "Gecode::IntSet", "lubD"
588
+ method.add_parameter "int", "cardMin", true
589
+ method.add_parameter "int", "cardMax", true
590
+ end
591
+
592
+ klass.add_constructor do |method|
593
+ method.add_parameter "Gecode::MSpace*", "home"
594
+ method.add_parameter "Gecode::IntSet", "glbD"
595
+ method.add_parameter "Gecode::IntSet", "lubD"
596
+ method.add_parameter "int", "cardMin", true
597
+ method.add_parameter "int", "cardMax", true
598
+ end
599
+
600
+ klass.add_method "glbSize", "int"
601
+ klass.add_method "lubSize", "int"
602
+ klass.add_method "unknownSize", "int"
603
+ klass.add_method "cardMin", "int"
604
+ klass.add_method "cardMax", "int"
605
+ klass.add_method "lubMin", "int"
606
+ klass.add_method "lubMax", "int"
607
+ klass.add_method "glbMin", "int"
608
+ klass.add_method "glbMax", "int"
609
+ klass.add_method "glbSize", "int"
610
+ klass.add_method "contains", "bool" do |method|
611
+ method.add_parameter "int", "i"
612
+ end
613
+
614
+ klass.add_method "notContains", "bool" do |method|
615
+ method.add_parameter "int", "i"
616
+ end
617
+
618
+ klass.add_method "assigned", "bool"
619
+
620
+ klass.add_method "update" do |method|
621
+ method.add_parameter "Gecode::MSpace *", "home"
622
+ method.add_parameter "bool", "shared"
623
+ method.add_parameter "Gecode::SetVar", "x"
624
+ end
625
+ end
626
+
627
+ ns.add_cxx_class "MDFS" do |klass|
628
+ klass.bindname = "DFS"
629
+ klass.add_constructor do |method|
630
+ method.add_parameter "Gecode::MSpace *", "s"
631
+ method.add_parameter "int", "c_d"
632
+ method.add_parameter "int", "a_d"
633
+ method.add_parameter "Gecode::Search::MStop *", "st"
634
+ end
635
+
636
+ klass.add_method "next", "Gecode::MSpace *"
637
+ klass.add_method "statistics", "Gecode::Search::Statistics"
638
+ end
639
+
640
+ ns.add_cxx_class "MBAB" do |klass|
641
+ klass.bindname = "BAB"
642
+ klass.add_constructor do |method|
643
+ method.add_parameter "Gecode::MSpace *", "s"
644
+ method.add_parameter "Gecode::Search::Options", "o"
645
+ end
646
+
647
+ klass.add_method "next", "Gecode::MSpace *"
648
+ klass.add_method "statistics", "Gecode::Search::Statistics"
649
+ end
650
+
651
+ ns.add_cxx_class "DFA" do |klass|
652
+ klass.add_constructor
653
+ end
654
+
655
+ ns.add_cxx_class "REG" do |klass|
656
+ klass.add_constructor
657
+
658
+ klass.add_constructor do |method|
659
+ method.add_parameter "int", "s"
660
+ end
661
+
662
+ klass.add_constructor do |method|
663
+ method.add_parameter "Gecode::IntArgs&", "x"
664
+ end
665
+
666
+ klass.add_constructor do |method|
667
+ method.add_parameter "Gecode::REG&", "r"
668
+ end
669
+
670
+ klass.add_operator "+", "Gecode::REG" do |operator|
671
+ operator.add_parameter "Gecode::REG&", "r"
672
+ end
673
+
674
+ klass.add_operator "+=", "Gecode::REG&" do |operator|
675
+ operator.add_parameter "Gecode::REG&", "r"
676
+ end
677
+
678
+ klass.add_operator "|", "Gecode::REG" do |operator|
679
+ operator.add_parameter "Gecode::REG&", "r"
680
+ end
681
+
682
+ klass.add_operator "|=", "Gecode::REG&" do |operator|
683
+ operator.add_parameter "Gecode::REG&", "r"
684
+ end
685
+
686
+ klass.add_operator "*", "Gecode::REG" do |operator|
687
+ end
688
+
689
+ klass.add_operator "+", "Gecode::REG" do |operator|
690
+ end
691
+
692
+ klass.add_operator "()", "Gecode::REG" do |operator|
693
+ operator.add_parameter "int", "n"
694
+ operator.add_parameter "int", "m"
695
+ end
696
+
697
+ klass.add_operator "()", "Gecode::REG" do |operator|
698
+ operator.add_parameter "int", "n"
699
+ end
700
+ end
701
+
702
+ # SEARCH NAMESPACE
703
+
704
+ ns.add_namespace "Search" do |searchns|
705
+ searchns.add_cxx_class "MStop" do |klass|
706
+ klass.bindname = "Stop"
707
+ klass.add_constructor
708
+ end
709
+
710
+ searchns.add_cxx_class "Statistics" do |klass|
711
+ klass.add_constructor
712
+ klass.add_attribute "memory", "int"
713
+ klass.add_attribute "propagate", "int"
714
+ klass.add_attribute "fail", "int"
715
+ klass.add_attribute "clone", "int"
716
+ klass.add_attribute "commit", "int"
717
+ end
718
+
719
+ searchns.add_cxx_class "Options" do |klass|
720
+ klass.add_constructor
721
+ klass.add_attribute "c_d", "int"
722
+ klass.add_attribute "a_d", "int"
723
+ klass.add_attribute "stop", "Gecode::Search::MStop*"
724
+ end
725
+
726
+ searchns.add_namespace "Config" do |intns|
727
+ intns.add_constant "ADAPTIVE_DISTANCE", "Gecode::Search::Config::a_d"
728
+ intns.add_constant "MINIMAL_DISTANCE", "Gecode::Search::Config::c_d"
729
+ end
730
+ end
731
+
732
+ # MINIMODEL NAMESPACE
733
+
734
+ ns.add_namespace "MiniModel" do |minimodelns|
735
+ ['Gecode::IntVar', 'Gecode::BoolVar'].each do |template_type|
736
+ minimodelns.add_cxx_class "LinExpr<#{template_type}>" do |klass|
737
+ klass.add_constructor
738
+
739
+ klass.add_constructor do |method|
740
+ method.add_parameter "#{template_type}&", "x"
741
+ method.add_parameter "int", "a", true
742
+ end
743
+
744
+ klass.add_method "post" do |method|
745
+ method.add_parameter "Gecode::MSpace *", "home"
746
+ method.add_parameter "Gecode::IntRelType", "irt"
747
+ method.add_parameter "Gecode::IntConLevel", "icl"
748
+ method.add_parameter "Gecode::PropKind", "pk"
749
+ end
750
+
751
+ klass.add_method "post" do |method|
752
+ method.add_parameter "Gecode::MSpace *", "home"
753
+ method.add_parameter "Gecode::IntRelType", "irt"
754
+ method.add_parameter "Gecode::BoolVar", "b"
755
+ method.add_parameter "Gecode::IntConLevel", "icl"
756
+ method.add_parameter "Gecode::PropKind", "pk"
757
+ end
758
+
759
+ klass.add_operator "+", "Gecode::MiniModel::LinExpr<#{template_type}>" do |operator|
760
+ operator.add_parameter("Gecode::MiniModel::LinExpr<#{template_type}>", "exp")
761
+ end
762
+
763
+ klass.add_operator "+", "Gecode::MiniModel::LinExpr<#{template_type}>" do |operator|
764
+ operator.add_parameter(template_type, "exp")
765
+ end
766
+
767
+ klass.add_operator "+", "Gecode::MiniModel::LinExpr<#{template_type}>" do |operator|
768
+ operator.add_parameter("int", "c")
769
+ end
770
+
771
+ klass.add_operator "-", "Gecode::MiniModel::LinExpr<#{template_type}>" do |operator|
772
+ operator.add_parameter("Gecode::MiniModel::LinExpr<#{template_type}>", "exp")
773
+ end
774
+
775
+ klass.add_operator "-", "Gecode::MiniModel::LinExpr<#{template_type}>" do |operator|
776
+ operator.add_parameter(template_type, "exp")
777
+ end
778
+
779
+ klass.add_operator "-", "Gecode::MiniModel::LinExpr<#{template_type}>" do |operator|
780
+ operator.add_parameter("int", "c")
781
+ end
782
+
783
+ klass.add_operator "*", "Gecode::MiniModel::LinExpr<#{template_type}>" do |operator|
784
+ operator.add_parameter("int", "c")
785
+ end
786
+
787
+ klass.add_operator "==", "Gecode::MiniModel::LinRel<#{template_type}>", "equal" do |operator|
788
+ operator.add_parameter "Gecode::MiniModel::LinExpr<#{template_type}>", "other"
789
+ end
790
+
791
+ klass.add_operator "!=", "Gecode::MiniModel::LinRel<#{template_type}>", "different" do |operator|
792
+ operator.add_parameter "Gecode::MiniModel::LinExpr<#{template_type}>", "other"
793
+ end
794
+ end
795
+ end
796
+
797
+ minimodelns.add_cxx_class "BoolExpr" do |klass| # TODO
798
+ klass.add_enum "NodeType" do |enum|
799
+ enum.add_value "NT_VAR"
800
+ enum.add_value "NT_NOT"
801
+ enum.add_value "NT_AND"
802
+ enum.add_value "NT_OR"
803
+ enum.add_value "NT_IMP"
804
+ enum.add_value "NT_XOR"
805
+ enum.add_value "NT_EQV"
806
+ enum.add_value "NT_RLIN_INT"
807
+ enum.add_value "NT_RLIN_BOOL"
808
+ end
809
+ klass.add_constructor do |method|
810
+ method.add_parameter "Gecode::MiniModel::BoolExpr", "e"
811
+ end
812
+
813
+ klass.add_constructor do |method|
814
+ method.add_parameter "Gecode::BoolVar", "e"
815
+ end
816
+
817
+ klass.add_constructor do |method|
818
+ method.add_parameter "Gecode::MiniModel::BoolExpr", "l"
819
+ method.add_parameter "Gecode::MiniModel::BoolExpr::NodeType", "t"
820
+ method.add_parameter "Gecode::MiniModel::BoolExpr", "r"
821
+ end
822
+
823
+ klass.add_constructor do |method|
824
+ method.add_parameter "Gecode::MiniModel::BoolExpr", "l"
825
+ method.add_parameter "Gecode::MiniModel::BoolExpr::NodeType", "t"
826
+ end
827
+
828
+ klass.add_constructor do |method|
829
+ method.add_parameter "Gecode::MiniModel::LinRel<Gecode::IntVar>", "e"
830
+ end
831
+
832
+ klass.add_constructor do |method|
833
+ method.add_parameter "Gecode::MiniModel::LinRel<Gecode::BoolVar>", "e"
834
+ end
835
+
836
+ klass.add_method "post", "Gecode::BoolVar" do |method|
837
+ method.add_parameter "Gecode::MSpace *", "home"
838
+ method.add_parameter "Gecode::IntConLevel", "icl"
839
+ method.add_parameter "Gecode::PropKind", "pk"
840
+ end
841
+
842
+ klass.add_method "post" do |method|
843
+ method.add_parameter "Gecode::MSpace *", "home"
844
+ method.add_parameter "bool", "t"
845
+ method.add_parameter "Gecode::IntConLevel", "icl"
846
+ method.add_parameter "Gecode::PropKind", "pk"
847
+ end
848
+ end
849
+
850
+ minimodelns.add_cxx_class "BoolRel" do |klass|
851
+ klass.add_constructor do |method|
852
+ method.add_parameter "Gecode::MiniModel::BoolExpr", "e"
853
+ method.add_parameter "bool", "t"
854
+ end
855
+ end
856
+
857
+ ['Gecode::IntVar', 'Gecode::BoolVar'].each do |template_type|
858
+ minimodelns.add_cxx_class "LinRel<#{template_type}>" do |klass|
859
+ klass.add_constructor
860
+
861
+ klass.add_constructor do |method|
862
+ method.add_parameter "Gecode::MiniModel::LinExpr<#{template_type}>", "l"
863
+ method.add_parameter "Gecode::IntRelType", "irt"
864
+ method.add_parameter "Gecode::MiniModel::LinExpr<#{template_type}>", "r"
865
+ end
866
+
867
+ klass.add_constructor do |method|
868
+ method.add_parameter "Gecode::MiniModel::LinExpr<#{template_type}>", "l"
869
+ method.add_parameter "Gecode::IntRelType", "irt"
870
+ method.add_parameter "int", "r"
871
+ end
872
+
873
+ klass.add_constructor do |method|
874
+ method.add_parameter "int", "l"
875
+ method.add_parameter "Gecode::IntRelType", "irt"
876
+ method.add_parameter "Gecode::MiniModel::LinExpr<#{template_type}>", "r"
877
+ end
878
+
879
+ klass.add_method "post", "void" do |method|
880
+ method.add_parameter "Gecode::MSpace*", "home"
881
+ method.add_parameter "bool", "t"
882
+ method.add_parameter "Gecode::IntConLevel", "icl"
883
+ method.add_parameter "Gecode::PropKind", "pk"
884
+ end
885
+
886
+ klass.add_method "post", "void" do |method|
887
+ method.add_parameter "Gecode::MSpace*", "home"
888
+ method.add_parameter "Gecode::BoolVar", "b"
889
+ method.add_parameter "Gecode::IntConLevel", "icl"
890
+ method.add_parameter "Gecode::PropKind", "pk"
891
+ end
892
+ end
893
+ end
894
+ end
895
+
896
+
897
+
898
+ # INT POSTING FUNCTIONS
899
+
900
+ ns.add_function "abs" do |func|
901
+ func.add_parameter "Gecode::MSpace *", "home"
902
+ func.add_parameter "Gecode::IntVar", "x0"
903
+ func.add_parameter "Gecode::IntVar", "x1"
904
+ func.add_parameter "Gecode::IntConLevel", "icl"
905
+ func.add_parameter "Gecode::PropKind", "pk"
906
+ end
907
+
908
+ ns.add_function "max" do |func|
909
+ func.add_parameter "Gecode::MSpace *", "home"
910
+ func.add_parameter "Gecode::IntVar", "x0"
911
+ func.add_parameter "Gecode::IntVar", "x1"
912
+ func.add_parameter "Gecode::IntVar", "x2"
913
+ func.add_parameter "Gecode::IntConLevel", "icl"
914
+ func.add_parameter "Gecode::PropKind", "pk"
915
+ end
916
+
917
+ ns.add_function "max" do |func|
918
+ func.add_parameter "Gecode::MSpace *", "home"
919
+ func.add_parameter "Gecode::MIntVarArray", "arr" do |param|
920
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 1)->ptr()"
921
+ end
922
+ func.add_parameter "Gecode::IntVar", "y"
923
+ func.add_parameter "Gecode::IntConLevel", "icl"
924
+ func.add_parameter "Gecode::PropKind", "pk"
925
+ end
926
+
927
+ ns.add_function "min" do |func|
928
+ func.add_parameter "Gecode::MSpace *", "home"
929
+ func.add_parameter "Gecode::IntVar", "x0"
930
+ func.add_parameter "Gecode::IntVar", "x1"
931
+ func.add_parameter "Gecode::IntVar", "x2"
932
+ func.add_parameter "Gecode::IntConLevel", "icl"
933
+ func.add_parameter "Gecode::PropKind", "pk"
934
+ end
935
+
936
+ ns.add_function "min" do |func|
937
+ func.add_parameter "Gecode::MSpace *", "home"
938
+ func.add_parameter "Gecode::MIntVarArray", "x" do |param|
939
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 1)->ptr()"
940
+ end
941
+ func.add_parameter "Gecode::IntVar", "y"
942
+ func.add_parameter "Gecode::IntConLevel", "icl"
943
+ func.add_parameter "Gecode::PropKind", "pk"
944
+ end
945
+
946
+ ns.add_function "mult" do |func|
947
+ func.add_parameter "Gecode::MSpace *", "home"
948
+ func.add_parameter "Gecode::IntVar", "x0"
949
+ func.add_parameter "Gecode::IntVar", "x1"
950
+ func.add_parameter "Gecode::IntVar", "x2"
951
+ func.add_parameter "Gecode::IntConLevel", "icl"
952
+ func.add_parameter "Gecode::PropKind", "pk"
953
+ end
954
+
955
+ ns.add_function "sqr" do |func|
956
+ func.add_parameter "Gecode::MSpace *", "home"
957
+ func.add_parameter "Gecode::IntVar", "x0"
958
+ func.add_parameter "Gecode::IntVar", "x1"
959
+ func.add_parameter "Gecode::IntConLevel", "icl"
960
+ func.add_parameter "Gecode::PropKind", "pk"
961
+ end
962
+
963
+ ns.add_function "sqrt" do |func|
964
+ func.add_parameter "Gecode::MSpace *", "home"
965
+ func.add_parameter "Gecode::IntVar", "x0"
966
+ func.add_parameter "Gecode::IntVar", "x1"
967
+ func.add_parameter "Gecode::IntConLevel", "icl"
968
+ func.add_parameter "Gecode::PropKind", "pk"
969
+ end
970
+
971
+ ns.add_function "branch" do |func|
972
+ func.add_parameter "Gecode::MSpace *", "home"
973
+ func.add_parameter "Gecode::MIntVarArray *", "iva" do |param|
974
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
975
+ end
976
+ func.add_parameter "Gecode::IntVarBranch", "vars"
977
+ func.add_parameter "Gecode::IntValBranch", "vals"
978
+ end
979
+
980
+ ns.add_function "branch" do |func|
981
+ func.add_parameter "Gecode::MSpace *", "home"
982
+ func.add_parameter "Gecode::MBoolVarArray *", "iva" do |param|
983
+ param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[1], 2)->ptr()"
984
+ end
985
+ func.add_parameter "Gecode::IntVarBranch", "vars"
986
+ func.add_parameter "Gecode::IntValBranch", "vals"
987
+ end
988
+
989
+ ns.add_function "branch" do |func|
990
+ func.add_parameter "Gecode::MSpace *", "home"
991
+ func.add_parameter "Gecode::MSetVarArray *", "sva" do |param|
992
+ param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(argv[1], 2)->ptr()"
993
+ end
994
+ func.add_parameter "Gecode::SetVarBranch", "vars"
995
+ func.add_parameter "Gecode::SetValBranch", "vals"
996
+ end
997
+
998
+ ns.add_function "assign" do |func|
999
+ func.add_parameter "Gecode::MSpace *", "home"
1000
+ func.add_parameter "Gecode::MIntVarArray *", "iva" do |param|
1001
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(iva, 1)->ptr()"
1002
+ end
1003
+ func.add_parameter "Gecode::IntAssign", "vals"
1004
+ end
1005
+
1006
+ ns.add_function "channel" do |func|
1007
+ func.add_parameter "Gecode::MSpace*", "home"
1008
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1009
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1010
+ end
1011
+ func.add_parameter "Gecode::MIntVarArray *", "y" do |param|
1012
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[2], 3)->ptr()"
1013
+ end
1014
+ func.add_parameter "Gecode::IntConLevel", "icl"
1015
+ func.add_parameter "Gecode::PropKind", "pk"
1016
+ end
1017
+
1018
+ ns.add_function "channel" do |func|
1019
+ func.add_parameter "Gecode::MSpace*", "home"
1020
+ func.add_parameter "Gecode::IntVar", "x0"
1021
+ func.add_parameter "Gecode::BoolVar", "x1"
1022
+ func.add_parameter "Gecode::IntConLevel", "icl"
1023
+ func.add_parameter "Gecode::PropKind", "pk"
1024
+ end
1025
+
1026
+ ns.add_function "channel" do |func|
1027
+ func.add_parameter "Gecode::MSpace*", "home"
1028
+ func.add_parameter "Gecode::MBoolVarArray *", "x" do |param|
1029
+ param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[1], 2)->ptr()"
1030
+ end
1031
+ func.add_parameter "Gecode::IntVar", "y"
1032
+ func.add_parameter "int", "o"
1033
+ func.add_parameter "Gecode::IntConLevel", "icl"
1034
+ func.add_parameter "Gecode::PropKind", "pk"
1035
+ end
1036
+
1037
+ ns.add_function "count" do |func|
1038
+ func.add_parameter "Gecode::MSpace*", "home"
1039
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1040
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1041
+ end
1042
+
1043
+ func.add_parameter "int", "y"
1044
+ func.add_parameter "Gecode::IntRelType", "r"
1045
+ func.add_parameter "int", "m"
1046
+ func.add_parameter "Gecode::IntConLevel", "icl"
1047
+ func.add_parameter "Gecode::PropKind", "pk"
1048
+ end
1049
+
1050
+ ns.add_function "count" do |func|
1051
+ func.add_parameter "Gecode::MSpace*", "home"
1052
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1053
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1054
+ end
1055
+
1056
+ func.add_parameter "Gecode::IntVar", "y"
1057
+ func.add_parameter "Gecode::IntRelType", "r"
1058
+ func.add_parameter "int", "m"
1059
+ func.add_parameter "Gecode::IntConLevel", "icl"
1060
+ func.add_parameter "Gecode::PropKind", "pk"
1061
+ end
1062
+
1063
+ ns.add_function "count" do |func|
1064
+ func.add_parameter "Gecode::MSpace*", "home"
1065
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1066
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1067
+ end
1068
+
1069
+ func.add_parameter "int", "y"
1070
+ func.add_parameter "Gecode::IntRelType", "r"
1071
+ func.add_parameter "Gecode::IntVar", "m"
1072
+ func.add_parameter "Gecode::IntConLevel", "icl"
1073
+ func.add_parameter "Gecode::PropKind", "pk"
1074
+ end
1075
+
1076
+ ns.add_function "count" do |func|
1077
+ func.add_parameter "Gecode::MSpace*", "home"
1078
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1079
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1080
+ end
1081
+
1082
+ func.add_parameter "Gecode::IntVar", "y"
1083
+ func.add_parameter "Gecode::IntRelType", "r"
1084
+ func.add_parameter "Gecode::IntVar", "m"
1085
+ func.add_parameter "Gecode::IntConLevel", "icl"
1086
+ func.add_parameter "Gecode::PropKind", "pk"
1087
+ end
1088
+
1089
+ ns.add_function "distinct" do |func|
1090
+ func.add_parameter "Gecode::MSpace*", "home"
1091
+ func.add_parameter "Gecode::MIntVarArray *", "iva" do |param|
1092
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1093
+ end
1094
+ func.add_parameter "Gecode::IntConLevel", "icl"
1095
+ func.add_parameter "Gecode::PropKind", "pk"
1096
+ end
1097
+
1098
+ ns.add_function "distinct" do |func|
1099
+ func.add_parameter "Gecode::MSpace*", "home"
1100
+ func.add_parameter "Gecode::IntArgs", "x"
1101
+ func.add_parameter "Gecode::MIntVarArray *", "iva" do |param|
1102
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[2], 3)->ptr()"
1103
+ end
1104
+ func.add_parameter "Gecode::IntConLevel", "icl"
1105
+ func.add_parameter "Gecode::PropKind", "pk"
1106
+ end
1107
+
1108
+
1109
+ ns.add_function "dom" do |func|
1110
+ func.add_parameter "Gecode::MSpace*", "home"
1111
+ func.add_parameter "Gecode::IntVar", "x"
1112
+ func.add_parameter "int", "l"
1113
+ func.add_parameter "int", "m"
1114
+ func.add_parameter "Gecode::IntConLevel", "icl"
1115
+ func.add_parameter "Gecode::PropKind", "pk"
1116
+ end
1117
+
1118
+ ns.add_function "dom" do |func|
1119
+ func.add_parameter "Gecode::MSpace*", "home"
1120
+ func.add_parameter "Gecode::MIntVarArray *", "iva" do |param|
1121
+ param.custom_conversion = "*reinterpret_cast<Gecode::IntVarArgs *>(ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr())"
1122
+ end
1123
+ func.add_parameter "int", "l"
1124
+ func.add_parameter "int", "m"
1125
+ func.add_parameter "Gecode::IntConLevel", "icl"
1126
+ func.add_parameter "Gecode::PropKind", "pk"
1127
+ end
1128
+
1129
+ ns.add_function "dom" do |func|
1130
+ func.add_parameter "Gecode::MSpace*", "home"
1131
+ func.add_parameter "Gecode::IntVar", "x"
1132
+ func.add_parameter "Gecode::IntSet", "s"
1133
+ func.add_parameter "Gecode::IntConLevel", "icl"
1134
+ func.add_parameter "Gecode::PropKind", "pk"
1135
+ end
1136
+
1137
+ ns.add_function "dom" do |func|
1138
+ func.add_parameter "Gecode::MSpace*", "home"
1139
+ func.add_parameter "Gecode::MIntVarArray *", "iva" do |param|
1140
+ param.custom_conversion = "*reinterpret_cast<Gecode::IntVarArgs *>(ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr())"
1141
+ end
1142
+ func.add_parameter "Gecode::IntSet", "s"
1143
+ func.add_parameter "Gecode::IntConLevel", "icl"
1144
+ func.add_parameter "Gecode::PropKind", "pk"
1145
+ end
1146
+
1147
+ ns.add_function "dom" do |func|
1148
+ func.add_parameter "Gecode::MSpace*", "home"
1149
+ func.add_parameter "Gecode::IntVar", "x"
1150
+ func.add_parameter "int", "l"
1151
+ func.add_parameter "int", "m"
1152
+ func.add_parameter "Gecode::BoolVar", "b"
1153
+ func.add_parameter "Gecode::IntConLevel", "icl"
1154
+ func.add_parameter "Gecode::PropKind", "pk"
1155
+ end
1156
+
1157
+ ns.add_function "dom" do |func|
1158
+ func.add_parameter "Gecode::MSpace*", "home"
1159
+ func.add_parameter "Gecode::IntVar", "x"
1160
+ func.add_parameter "Gecode::IntSet", "s"
1161
+ func.add_parameter "Gecode::BoolVar", "b"
1162
+ func.add_parameter "Gecode::IntConLevel", "icl"
1163
+ func.add_parameter "Gecode::PropKind", "pk"
1164
+ end
1165
+
1166
+ ns.add_function "element", "void" do |func|
1167
+ func.add_parameter "Gecode::MSpace*", "home"
1168
+ func.add_parameter "Gecode::IntArgs&", "x"
1169
+ func.add_parameter "Gecode::IntVar", "y0"
1170
+ func.add_parameter "Gecode::IntVar", "y1"
1171
+ func.add_parameter "Gecode::IntConLevel", "icl"
1172
+ func.add_parameter "Gecode::PropKind", "pk"
1173
+ end
1174
+
1175
+ ns.add_function "element", "void" do |func|
1176
+ func.add_parameter "Gecode::MSpace*", "home"
1177
+ func.add_parameter "Gecode::MIntVarArray *", "iva" do |param|
1178
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1179
+ end
1180
+ func.add_parameter "Gecode::IntVar", "y0"
1181
+ func.add_parameter "Gecode::IntVar", "y1"
1182
+ func.add_parameter "Gecode::IntConLevel", "icl"
1183
+ func.add_parameter "Gecode::PropKind", "pk"
1184
+ end
1185
+
1186
+ ns.add_function "linear", "void" do |func|
1187
+ func.add_parameter "Gecode::MSpace*", "home"
1188
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1189
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1190
+ end
1191
+ func.add_parameter "Gecode::IntRelType", "r"
1192
+ func.add_parameter "int", "c"
1193
+ func.add_parameter "Gecode::IntConLevel", "icl"
1194
+ func.add_parameter "Gecode::PropKind", "pk"
1195
+ end
1196
+ ns.add_function "linear", "void" do |func|
1197
+ func.add_parameter "Gecode::MSpace*", "home"
1198
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1199
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1200
+ end
1201
+ func.add_parameter "Gecode::IntRelType", "r"
1202
+ func.add_parameter "int", "c"
1203
+ func.add_parameter "Gecode::BoolVar", "b"
1204
+ func.add_parameter "Gecode::IntConLevel", "icl"
1205
+ func.add_parameter "Gecode::PropKind", "pk"
1206
+ end
1207
+
1208
+ ns.add_function "linear", "void" do |func|
1209
+ func.add_parameter "Gecode::MSpace*", "home"
1210
+ func.add_parameter "Gecode::IntArgs", "a"
1211
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1212
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[2], 3)->ptr()"
1213
+ end
1214
+ func.add_parameter "Gecode::IntRelType", "r"
1215
+ func.add_parameter "int", "c"
1216
+ func.add_parameter "Gecode::IntConLevel", "icl"
1217
+ func.add_parameter "Gecode::PropKind", "pk"
1218
+ end
1219
+
1220
+ ns.add_function "linear", "void" do |func|
1221
+ func.add_parameter "Gecode::MSpace*", "home"
1222
+ func.add_parameter "Gecode::IntArgs", "a"
1223
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1224
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[2], 3)->ptr()"
1225
+ end
1226
+ func.add_parameter "Gecode::IntRelType", "r"
1227
+ func.add_parameter "int", "c"
1228
+ func.add_parameter "Gecode::BoolVar", "b"
1229
+ func.add_parameter "Gecode::IntConLevel", "icl"
1230
+ func.add_parameter "Gecode::PropKind", "pk"
1231
+ end
1232
+
1233
+ ns.add_function "linear", "void" do |func|
1234
+ func.add_parameter "Gecode::MSpace*", "home"
1235
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1236
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1237
+ end
1238
+ func.add_parameter "Gecode::IntRelType", "r"
1239
+ func.add_parameter "Gecode::IntVar", "c"
1240
+ func.add_parameter "Gecode::IntConLevel", "icl"
1241
+ func.add_parameter "Gecode::PropKind", "pk"
1242
+ end
1243
+
1244
+ ns.add_function "linear", "void" do |func|
1245
+ func.add_parameter "Gecode::MSpace*", "home"
1246
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1247
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1248
+ end
1249
+ func.add_parameter "Gecode::IntRelType", "r"
1250
+ func.add_parameter "Gecode::IntVar", "c"
1251
+ func.add_parameter "Gecode::BoolVar", "b"
1252
+ func.add_parameter "Gecode::IntConLevel", "icl"
1253
+ func.add_parameter "Gecode::PropKind", "pk"
1254
+ end
1255
+
1256
+
1257
+ ns.add_function "linear", "void" do |func|
1258
+ func.add_parameter "Gecode::MSpace*", "home"
1259
+ func.add_parameter "Gecode::IntArgs", "a"
1260
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1261
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[2], 3)->ptr()"
1262
+ end
1263
+ func.add_parameter "Gecode::IntRelType", "r"
1264
+ func.add_parameter "Gecode::IntVar", "y"
1265
+ func.add_parameter "Gecode::IntConLevel", "icl"
1266
+ func.add_parameter "Gecode::PropKind", "pk"
1267
+ end
1268
+
1269
+ ns.add_function "linear", "void" do |func|
1270
+ func.add_parameter "Gecode::MSpace*", "home"
1271
+ func.add_parameter "Gecode::IntArgs", "a"
1272
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1273
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[2], 3)->ptr()"
1274
+ end
1275
+ func.add_parameter "Gecode::IntRelType", "r"
1276
+ func.add_parameter "Gecode::IntVar", "y"
1277
+ func.add_parameter "Gecode::BoolVar", "b"
1278
+ func.add_parameter "Gecode::IntConLevel", "icl"
1279
+ func.add_parameter "Gecode::PropKind", "pk"
1280
+ end
1281
+
1282
+ ns.add_function "linear", "void" do |func|
1283
+ func.add_parameter "Gecode::MSpace*", "home"
1284
+ func.add_parameter "Gecode::MBoolVarArray *", "x" do |param|
1285
+ param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[1], 2)->ptr()"
1286
+ end
1287
+ func.add_parameter "Gecode::IntRelType", "r"
1288
+ func.add_parameter "int", "y"
1289
+ func.add_parameter "Gecode::IntConLevel", "icl"
1290
+ func.add_parameter "Gecode::PropKind", "pk"
1291
+ end
1292
+
1293
+ ns.add_function "linear", "void" do |func|
1294
+ func.add_parameter "Gecode::MSpace*", "home"
1295
+ func.add_parameter "Gecode::MBoolVarArray *", "x" do |param|
1296
+ param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[1], 2)->ptr()"
1297
+ end
1298
+ func.add_parameter "Gecode::IntRelType", "r"
1299
+ func.add_parameter "Gecode::IntVar", "y"
1300
+ func.add_parameter "Gecode::IntConLevel", "icl"
1301
+ func.add_parameter "Gecode::PropKind", "pk"
1302
+ end
1303
+
1304
+ ns.add_function "extensional", "void" do |func|
1305
+ func.add_parameter "Gecode::MSpace*", "home"
1306
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1307
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1308
+ end
1309
+ func.add_parameter "Gecode::TupleSet", "t"
1310
+ func.add_parameter "Gecode::IntConLevel", "icl"
1311
+ func.add_parameter "Gecode::PropKind", "pk"
1312
+ end
1313
+
1314
+ ns.add_function "extensional", "void" do |func|
1315
+ func.add_parameter "Gecode::MSpace*", "home"
1316
+ func.add_parameter "Gecode::MBoolVarArray *", "x" do |param|
1317
+ param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[1], 2)->ptr()"
1318
+ end
1319
+ func.add_parameter "Gecode::TupleSet", "t"
1320
+ func.add_parameter "Gecode::IntConLevel", "icl"
1321
+ func.add_parameter "Gecode::PropKind", "pk"
1322
+ end
1323
+
1324
+ ns.add_function "extensional", "void" do |func|
1325
+ func.add_parameter "Gecode::MSpace*", "home"
1326
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1327
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1328
+ end
1329
+ func.add_parameter "Gecode::REG", "dfa"
1330
+ func.add_parameter "Gecode::IntConLevel", "icl"
1331
+ func.add_parameter "Gecode::PropKind", "pk"
1332
+ end
1333
+
1334
+ ns.add_function "extensional", "void" do |func|
1335
+ func.add_parameter "Gecode::MSpace*", "home"
1336
+ func.add_parameter "Gecode::MBoolVarArray *", "x" do |param|
1337
+ param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[1], 2)->ptr()"
1338
+ end
1339
+ func.add_parameter "Gecode::REG", "dfa"
1340
+ func.add_parameter "Gecode::IntConLevel", "icl"
1341
+ func.add_parameter "Gecode::PropKind", "pk"
1342
+ end
1343
+
1344
+ ns.add_function "bab", "Gecode::MSpace*" do |func|
1345
+ func.add_parameter "Gecode::MSpace*", "home"
1346
+ func.add_parameter "Gecode::Search::Options", "o"
1347
+ end
1348
+
1349
+ ns.add_function "rel" do |func|
1350
+ func.add_parameter "Gecode::MSpace*", "home"
1351
+ func.add_parameter "Gecode::IntVar", "x0"
1352
+ func.add_parameter "Gecode::IntRelType", "r"
1353
+ func.add_parameter "int", "c"
1354
+ func.add_parameter "Gecode::IntConLevel", "icl"
1355
+ func.add_parameter "Gecode::PropKind", "pk"
1356
+ end
1357
+
1358
+ ns.add_function "rel" do |func|
1359
+ func.add_parameter "Gecode::MSpace*", "home"
1360
+ func.add_parameter "Gecode::IntVar", "x0"
1361
+ func.add_parameter "Gecode::IntRelType", "r"
1362
+ func.add_parameter "Gecode::IntVar", "x1"
1363
+ func.add_parameter "Gecode::IntConLevel", "icl"
1364
+ func.add_parameter "Gecode::PropKind", "pk"
1365
+ end
1366
+
1367
+ ns.add_function "rel" do |func|
1368
+ func.add_parameter "Gecode::MSpace*", "home"
1369
+ func.add_parameter "Gecode::IntVar", "x0"
1370
+ func.add_parameter "Gecode::IntRelType", "r"
1371
+ func.add_parameter "Gecode::IntVar", "x1"
1372
+ func.add_parameter "Gecode::BoolVar", "b"
1373
+ func.add_parameter "Gecode::IntConLevel", "icl"
1374
+ func.add_parameter "Gecode::PropKind", "pk"
1375
+ end
1376
+
1377
+ ns.add_function "rel" do |func|
1378
+ func.add_parameter "Gecode::MSpace*", "home"
1379
+ func.add_parameter "Gecode::IntVar", "x0"
1380
+ func.add_parameter "Gecode::IntRelType", "r"
1381
+ func.add_parameter "int", "c"
1382
+ func.add_parameter "Gecode::BoolVar", "b"
1383
+ func.add_parameter "Gecode::IntConLevel", "icl"
1384
+ func.add_parameter "Gecode::PropKind", "pk"
1385
+ end
1386
+
1387
+ ns.add_function "rel" do |func|
1388
+ func.add_parameter "Gecode::MSpace*", "home"
1389
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1390
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1391
+ end
1392
+ func.add_parameter "Gecode::IntRelType", "r"
1393
+ func.add_parameter "Gecode::IntConLevel", "icl"
1394
+ func.add_parameter "Gecode::PropKind", "pk"
1395
+ end
1396
+
1397
+ ns.add_function "rel" do |func|
1398
+ func.add_parameter "Gecode::MSpace*", "home"
1399
+ func.add_parameter "Gecode::MBoolVarArray *", "x" do |param|
1400
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1401
+ end
1402
+ func.add_parameter "Gecode::IntRelType", "r"
1403
+ func.add_parameter "Gecode::MIntVarArray *", "y" do |param|
1404
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[3], 4)->ptr()"
1405
+ end
1406
+ func.add_parameter "Gecode::IntConLevel", "icl"
1407
+ func.add_parameter "Gecode::PropKind", "pk"
1408
+ end
1409
+
1410
+ ns.add_function "rel" do |func|
1411
+ func.add_parameter "Gecode::MSpace*", "home"
1412
+ func.add_parameter "Gecode::BoolVar", "x0"
1413
+ func.add_parameter "Gecode::IntRelType", "r"
1414
+ func.add_parameter "int", "c"
1415
+ func.add_parameter "Gecode::IntConLevel", "icl"
1416
+ func.add_parameter "Gecode::PropKind", "pk"
1417
+ end
1418
+
1419
+ ns.add_function "rel" do |func|
1420
+ func.add_parameter "Gecode::MSpace*", "home"
1421
+ func.add_parameter "Gecode::BoolVar", "x0"
1422
+ func.add_parameter "Gecode::IntRelType", "r"
1423
+ func.add_parameter "Gecode::BoolVar", "x1"
1424
+ func.add_parameter "Gecode::IntConLevel", "icl"
1425
+ func.add_parameter "Gecode::PropKind", "pk"
1426
+ end
1427
+
1428
+ ns.add_function "rel" do |func|
1429
+ func.add_parameter "Gecode::MSpace*", "home"
1430
+ func.add_parameter "Gecode::BoolVar", "x0"
1431
+ func.add_parameter "Gecode::BoolOpType", "o"
1432
+ func.add_parameter "Gecode::BoolVar", "x1"
1433
+ func.add_parameter "Gecode::BoolVar", "x2"
1434
+ func.add_parameter "Gecode::IntConLevel", "icl"
1435
+ func.add_parameter "Gecode::PropKind", "pk"
1436
+ end
1437
+
1438
+ ns.add_function "rel" do |func|
1439
+ func.add_parameter "Gecode::MSpace*", "home"
1440
+ func.add_parameter "Gecode::BoolVar", "x0"
1441
+ func.add_parameter "Gecode::BoolOpType", "o"
1442
+ func.add_parameter "Gecode::BoolVar", "x1"
1443
+ func.add_parameter "int", "n"
1444
+ func.add_parameter "Gecode::IntConLevel", "icl"
1445
+ func.add_parameter "Gecode::PropKind", "pk"
1446
+ end
1447
+
1448
+ ns.add_function "rel" do |func|
1449
+ func.add_parameter "Gecode::MSpace*", "home"
1450
+ func.add_parameter "Gecode::BoolOpType", "o"
1451
+ func.add_parameter "Gecode::MBoolVarArray *", "x" do |param|
1452
+ param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[2], 2)->ptr()"
1453
+ end
1454
+ func.add_parameter "int", "n"
1455
+ func.add_parameter "Gecode::IntConLevel", "icl"
1456
+ func.add_parameter "Gecode::PropKind", "pk"
1457
+ end
1458
+
1459
+ ns.add_function "rel" do |func|
1460
+ func.add_parameter "Gecode::MSpace*", "home"
1461
+ func.add_parameter "Gecode::BoolOpType", "o"
1462
+ func.add_parameter "Gecode::MBoolVarArray *", "x" do |param|
1463
+ param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[2], 2)->ptr()"
1464
+ end
1465
+ func.add_parameter "Gecode::BoolVar", "y"
1466
+ func.add_parameter "Gecode::IntConLevel", "icl"
1467
+ func.add_parameter "Gecode::PropKind", "pk"
1468
+ end
1469
+
1470
+ ns.add_function "rel" do |func|
1471
+ func.add_parameter "Gecode::MSpace*", "home"
1472
+ func.add_parameter "Gecode::MBoolVarArray *", "x" do |param|
1473
+ param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[1], 2)->ptr()"
1474
+ end
1475
+ func.add_parameter "Gecode::IntRelType", "r"
1476
+ func.add_parameter "Gecode::MBoolVarArray *", "y" do |param|
1477
+ param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[3], 4)->ptr()"
1478
+ end
1479
+ func.add_parameter "Gecode::IntConLevel", "icl"
1480
+ func.add_parameter "Gecode::PropKind", "pk"
1481
+ end
1482
+
1483
+ ns.add_function "sorted", "void" do |func|
1484
+ func.add_parameter "Gecode::MSpace*", "home"
1485
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1486
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1487
+ end
1488
+ func.add_parameter "Gecode::MIntVarArray *", "y" do |param|
1489
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[2], 3)->ptr()"
1490
+ end
1491
+ func.add_parameter "Gecode::IntConLevel", "icl"
1492
+ func.add_parameter "Gecode::PropKind", "pk"
1493
+ end
1494
+
1495
+ ns.add_function "sorted", "void" do |func|
1496
+ func.add_parameter "Gecode::MSpace*", "home"
1497
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1498
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1499
+ end
1500
+ func.add_parameter "Gecode::MIntVarArray *", "y" do |param|
1501
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[2], 3)->ptr()"
1502
+ end
1503
+ func.add_parameter "Gecode::MIntVarArray *", "z" do |param|
1504
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[3], 4)->ptr()"
1505
+ end
1506
+ func.add_parameter "Gecode::IntConLevel", "icl"
1507
+ func.add_parameter "Gecode::PropKind", "pk"
1508
+ end
1509
+
1510
+ ns.add_function "post", "Gecode::BoolVar" do |func|
1511
+ func.add_parameter "Gecode::MSpace*", "home"
1512
+ func.add_parameter "Gecode::MiniModel::BoolExpr", "e"
1513
+ func.add_parameter "Gecode::IntConLevel", "icl"
1514
+ func.add_parameter "Gecode::PropKind", "pk"
1515
+ end
1516
+
1517
+ ns.add_function "post", "Gecode::BoolVar" do |func|
1518
+ func.add_parameter "Gecode::MSpace*", "home"
1519
+ func.add_parameter "Gecode::BoolVar", "e"
1520
+ func.add_parameter "Gecode::IntConLevel", "icl"
1521
+ func.add_parameter "Gecode::PropKind", "pk"
1522
+ end
1523
+
1524
+ ns.add_function "post" do |func|
1525
+ func.add_parameter "Gecode::MSpace*", "home"
1526
+ func.add_parameter "Gecode::MiniModel::BoolRel", "r"
1527
+ func.add_parameter "Gecode::IntConLevel", "icl"
1528
+ func.add_parameter "Gecode::PropKind", "pk"
1529
+ end
1530
+
1531
+ ns.add_function "post", "Gecode::IntVar" do |func|
1532
+ func.add_parameter "Gecode::MSpace*", "home"
1533
+ func.add_parameter "Gecode::IntVar", "e"
1534
+ func.add_parameter "Gecode::IntConLevel", "icl"
1535
+ func.add_parameter "Gecode::PropKind", "pk"
1536
+ end
1537
+
1538
+ ns.add_function "post", "Gecode::IntVar" do |func|
1539
+ func.add_parameter "Gecode::MSpace*", "home"
1540
+ func.add_parameter "int", "n"
1541
+ func.add_parameter "Gecode::IntConLevel", "icl"
1542
+ func.add_parameter "Gecode::PropKind", "pk"
1543
+ end
1544
+
1545
+ ns.add_function "post", "Gecode::IntVar" do |func|
1546
+ func.add_parameter "Gecode::MSpace*", "home"
1547
+ func.add_parameter "Gecode::MiniModel::LinExpr<Gecode::IntVar>", "e"
1548
+ func.add_parameter "Gecode::IntConLevel", "icl"
1549
+ func.add_parameter "Gecode::PropKind", "pk"
1550
+ end
1551
+
1552
+ ns.add_function "post" do |func|
1553
+ func.add_parameter "Gecode::MSpace*", "home"
1554
+ func.add_parameter "Gecode::MiniModel::LinRel<Gecode::IntVar>", "e"
1555
+ func.add_parameter "Gecode::IntConLevel", "icl"
1556
+ func.add_parameter "Gecode::PropKind", "pk"
1557
+ end
1558
+
1559
+ ns.add_function "post" do |func|
1560
+ func.add_parameter "Gecode::MSpace*", "home"
1561
+ func.add_parameter "bool", "r"
1562
+ func.add_parameter "Gecode::IntConLevel", "icl"
1563
+ func.add_parameter "Gecode::PropKind", "pk"
1564
+ end
1565
+
1566
+ ns.add_function "atmost" do |func|
1567
+ func.add_parameter "Gecode::MSpace*", "home"
1568
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1569
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1570
+ end
1571
+ func.add_parameter "int", "n"
1572
+ func.add_parameter "int", "m"
1573
+ func.add_parameter "Gecode::IntConLevel", "icl"
1574
+ func.add_parameter "Gecode::PropKind", "pk"
1575
+ end
1576
+
1577
+ ns.add_function "atmost" do |func|
1578
+ func.add_parameter "Gecode::MSpace*", "home"
1579
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1580
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1581
+ end
1582
+ func.add_parameter "Gecode::IntVar", "n"
1583
+ func.add_parameter "int", "m"
1584
+ func.add_parameter "Gecode::IntConLevel", "icl"
1585
+ func.add_parameter "Gecode::PropKind", "pk"
1586
+ end
1587
+
1588
+ ns.add_function "atmost" do |func|
1589
+ func.add_parameter "Gecode::MSpace*", "home"
1590
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1591
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1592
+ end
1593
+ func.add_parameter "int", "n"
1594
+ func.add_parameter "Gecode::IntVar", "m"
1595
+ func.add_parameter "Gecode::IntConLevel", "icl"
1596
+ func.add_parameter "Gecode::PropKind", "pk"
1597
+ end
1598
+
1599
+ ns.add_function "atmost" do |func|
1600
+ func.add_parameter "Gecode::MSpace*", "home"
1601
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1602
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1603
+ end
1604
+ func.add_parameter "Gecode::IntVar", "n"
1605
+ func.add_parameter "Gecode::IntVar", "m"
1606
+ func.add_parameter "Gecode::IntConLevel", "icl"
1607
+ func.add_parameter "Gecode::PropKind", "pk"
1608
+ end
1609
+
1610
+ ns.add_function "atleast" do |func|
1611
+ func.add_parameter "Gecode::MSpace*", "home"
1612
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1613
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1614
+ end
1615
+ func.add_parameter "int", "n"
1616
+ func.add_parameter "int", "m"
1617
+ func.add_parameter "Gecode::IntConLevel", "icl"
1618
+ func.add_parameter "Gecode::PropKind", "pk"
1619
+ end
1620
+
1621
+ ns.add_function "atleast" do |func|
1622
+ func.add_parameter "Gecode::MSpace*", "home"
1623
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1624
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1625
+ end
1626
+ func.add_parameter "Gecode::IntVar", "n"
1627
+ func.add_parameter "int", "m"
1628
+ func.add_parameter "Gecode::IntConLevel", "icl"
1629
+ func.add_parameter "Gecode::PropKind", "pk"
1630
+ end
1631
+
1632
+ ns.add_function "atleast" do |func|
1633
+ func.add_parameter "Gecode::MSpace*", "home"
1634
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1635
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1636
+ end
1637
+ func.add_parameter "int", "n"
1638
+ func.add_parameter "Gecode::IntVar", "m"
1639
+ func.add_parameter "Gecode::IntConLevel", "icl"
1640
+ func.add_parameter "Gecode::PropKind", "pk"
1641
+ end
1642
+
1643
+ ns.add_function "atleast" do |func|
1644
+ func.add_parameter "Gecode::MSpace*", "home"
1645
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1646
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1647
+ end
1648
+ func.add_parameter "Gecode::IntVar", "n"
1649
+ func.add_parameter "Gecode::IntVar", "m"
1650
+ func.add_parameter "Gecode::IntConLevel", "icl"
1651
+ func.add_parameter "Gecode::PropKind", "pk"
1652
+ end
1653
+
1654
+ ns.add_function "exactly" do |func|
1655
+ func.add_parameter "Gecode::MSpace*", "home"
1656
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1657
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1658
+ end
1659
+ func.add_parameter "int", "n"
1660
+ func.add_parameter "int", "m"
1661
+ func.add_parameter "Gecode::IntConLevel", "icl"
1662
+ func.add_parameter "Gecode::PropKind", "pk"
1663
+ end
1664
+
1665
+ ns.add_function "exactly" do |func|
1666
+ func.add_parameter "Gecode::MSpace*", "home"
1667
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1668
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1669
+ end
1670
+ func.add_parameter "Gecode::IntVar", "n"
1671
+ func.add_parameter "int", "m"
1672
+ func.add_parameter "Gecode::IntConLevel", "icl"
1673
+ func.add_parameter "Gecode::PropKind", "pk"
1674
+ end
1675
+
1676
+ ns.add_function "exactly" do |func|
1677
+ func.add_parameter "Gecode::MSpace*", "home"
1678
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1679
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1680
+ end
1681
+ func.add_parameter "int", "n"
1682
+ func.add_parameter "Gecode::IntVar", "m"
1683
+ func.add_parameter "Gecode::IntConLevel", "icl"
1684
+ func.add_parameter "Gecode::PropKind", "pk"
1685
+ end
1686
+
1687
+ ns.add_function "exactly" do |func|
1688
+ func.add_parameter "Gecode::MSpace*", "home"
1689
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1690
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1691
+ end
1692
+ func.add_parameter "Gecode::IntVar", "n"
1693
+ func.add_parameter "Gecode::IntVar", "m"
1694
+ func.add_parameter "Gecode::IntConLevel", "icl"
1695
+ func.add_parameter "Gecode::PropKind", "pk"
1696
+ end
1697
+
1698
+ ns.add_function "lex" do |func|
1699
+ func.add_parameter "Gecode::MSpace*", "home"
1700
+ func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
1701
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1702
+ end
1703
+ func.add_parameter "Gecode::IntRelType", "r"
1704
+ func.add_parameter "Gecode::MIntVarArray *", "y" do |param|
1705
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[3], 4)->ptr()"
1706
+ end
1707
+ func.add_parameter "Gecode::IntConLevel", "icl", true
1708
+ func.add_parameter "Gecode::PropKind", "pk", true
1709
+ end
1710
+
1711
+ ns.add_function "cardinality" do |func|
1712
+ func.add_parameter "Gecode::MSpace*", "home"
1713
+ func.add_parameter "Gecode::SetVar", "x"
1714
+ func.add_parameter "int", "i"
1715
+ func.add_parameter "int", "j"
1716
+ end
1717
+
1718
+ ns.add_function "cardinality" do |func|
1719
+ func.add_parameter "Gecode::MSpace*", "home"
1720
+ func.add_parameter "Gecode::SetVar", "s"
1721
+ func.add_parameter "Gecode::IntVar", "x"
1722
+ end
1723
+
1724
+ ns.add_function "convex" do |func|
1725
+ func.add_parameter "Gecode::MSpace*", "home"
1726
+ func.add_parameter "Gecode::SetVar", "s"
1727
+ end
1728
+
1729
+ ns.add_function "convexHull" do |func|
1730
+ func.add_parameter "Gecode::MSpace*", "home"
1731
+ func.add_parameter "Gecode::SetVar", "x"
1732
+ func.add_parameter "Gecode::SetVar", "y"
1733
+ end
1734
+
1735
+ ns.add_function "atmostOne" do |func|
1736
+ func.add_parameter "Gecode::MSpace*", "home"
1737
+ func.add_parameter "Gecode::MSetVarArray", "x" do |param|
1738
+ param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(x, 2)->ptr()"
1739
+ end
1740
+ func.add_parameter "int", "c"
1741
+ end
1742
+
1743
+ ns.add_function "dom" do |func|
1744
+ func.add_parameter "Gecode::MSpace*", "home"
1745
+ func.add_parameter "Gecode::SetVar", "x"
1746
+ func.add_parameter "Gecode::SetRelType", "r"
1747
+ func.add_parameter "int", "i"
1748
+ end
1749
+
1750
+ ns.add_function "dom" do |func|
1751
+ func.add_parameter "Gecode::MSpace*", "home"
1752
+ func.add_parameter "Gecode::SetVar", "x"
1753
+ func.add_parameter "Gecode::SetRelType", "r"
1754
+ func.add_parameter "int", "i"
1755
+ func.add_parameter "int", "j"
1756
+ end
1757
+
1758
+
1759
+ ns.add_function "dom" do |func|
1760
+ func.add_parameter "Gecode::MSpace*", "home"
1761
+ func.add_parameter "Gecode::SetVar", "x"
1762
+ func.add_parameter "Gecode::SetRelType", "r"
1763
+ func.add_parameter "Gecode::IntSet", "s"
1764
+ end
1765
+
1766
+ ns.add_function "dom" do |func|
1767
+ func.add_parameter "Gecode::MSpace*", "home"
1768
+ func.add_parameter "Gecode::SetVar", "x"
1769
+ func.add_parameter "Gecode::SetRelType", "r"
1770
+ func.add_parameter "int", "i"
1771
+ func.add_parameter "Gecode::BoolVar", "b"
1772
+ end
1773
+
1774
+ ns.add_function "dom" do |func|
1775
+ func.add_parameter "Gecode::MSpace*", "home"
1776
+ func.add_parameter "Gecode::SetVar", "x"
1777
+ func.add_parameter "Gecode::SetRelType", "r"
1778
+ func.add_parameter "int", "i"
1779
+ func.add_parameter "int", "j"
1780
+ func.add_parameter "Gecode::BoolVar", "b"
1781
+ end
1782
+
1783
+ ns.add_function "dom" do |func|
1784
+ func.add_parameter "Gecode::MSpace*", "home"
1785
+ func.add_parameter "Gecode::SetVar", "x"
1786
+ func.add_parameter "Gecode::SetRelType", "r"
1787
+ func.add_parameter "Gecode::IntSet", "s"
1788
+ func.add_parameter "Gecode::BoolVar", "b"
1789
+ end
1790
+
1791
+ ns.add_function "rel" do |func|
1792
+ func.add_parameter "Gecode::MSpace*", "home"
1793
+ func.add_parameter "Gecode::SetVar", "s"
1794
+ func.add_parameter "Gecode::IntRelType", "r"
1795
+ func.add_parameter "Gecode::IntVar", "x"
1796
+ end
1797
+
1798
+ ns.add_function "rel" do |func|
1799
+ func.add_parameter "Gecode::MSpace*", "home"
1800
+ func.add_parameter "Gecode::IntVar", "x"
1801
+ func.add_parameter "Gecode::IntRelType", "r"
1802
+ func.add_parameter "Gecode::SetVar", "s"
1803
+ end
1804
+
1805
+ ns.add_function "min" do |func|
1806
+ func.add_parameter "Gecode::MSpace*", "home"
1807
+ func.add_parameter "Gecode::SetVar", "s"
1808
+ func.add_parameter "Gecode::IntVar", "x"
1809
+ end
1810
+
1811
+ ns.add_function "max" do |func|
1812
+ func.add_parameter "Gecode::MSpace*", "home"
1813
+ func.add_parameter "Gecode::SetVar", "s"
1814
+ func.add_parameter "Gecode::IntVar", "x"
1815
+ end
1816
+
1817
+ ns.add_function "match" do |func|
1818
+ func.add_parameter "Gecode::MSpace*", "home"
1819
+ func.add_parameter "Gecode::SetVar", "s"
1820
+ func.add_parameter "Gecode::MIntVarArray", "x" do |param|
1821
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(x, 3)->ptr()"
1822
+ end
1823
+ end
1824
+
1825
+ ns.add_function "channel" do |func|
1826
+ func.add_parameter "Gecode::MSpace*", "home"
1827
+ func.add_parameter "Gecode::MIntVarArray", "x" do |param|
1828
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
1829
+ end
1830
+ func.add_parameter "Gecode::MSetVarArray", "y" do |param|
1831
+ param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(argv[2], 3)->ptr()"
1832
+ end
1833
+ end
1834
+
1835
+ ns.add_function "channel" do |func|
1836
+ func.add_parameter "Gecode::MSpace*", "home"
1837
+ func.add_parameter "Gecode::MBoolVarArray", "x" do |param|
1838
+ param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[1], 2)->ptr()"
1839
+ end
1840
+ func.add_parameter "Gecode::SetVar", "y"
1841
+ end
1842
+
1843
+ ns.add_function "weights" do |func|
1844
+ func.add_parameter "Gecode::MSpace*", "home"
1845
+ func.add_parameter "Gecode::IntArgs", "elements"
1846
+ func.add_parameter "Gecode::IntArgs", "weights"
1847
+ func.add_parameter "Gecode::SetVar", "x"
1848
+ func.add_parameter "Gecode::IntVar", "y"
1849
+ end
1850
+
1851
+ ns.add_function "rel" do |func|
1852
+ func.add_parameter "Gecode::MSpace*", "home"
1853
+ func.add_parameter "Gecode::IntSet", "x"
1854
+ func.add_parameter "Gecode::SetOpType", "op"
1855
+ func.add_parameter "Gecode::SetVar", "y"
1856
+ func.add_parameter "Gecode::SetRelType", "r"
1857
+ func.add_parameter "Gecode::SetVar", "z"
1858
+ end
1859
+
1860
+ ns.add_function "rel" do |func|
1861
+ func.add_parameter "Gecode::MSpace*", "home"
1862
+ func.add_parameter "Gecode::SetVar", "x"
1863
+ func.add_parameter "Gecode::SetOpType", "op"
1864
+ func.add_parameter "Gecode::IntSet", "y"
1865
+ func.add_parameter "Gecode::SetRelType", "r"
1866
+ func.add_parameter "Gecode::SetVar", "z"
1867
+ end
1868
+
1869
+ ns.add_function "rel" do |func|
1870
+ func.add_parameter "Gecode::MSpace*", "home"
1871
+ func.add_parameter "Gecode::SetVar", "x"
1872
+ func.add_parameter "Gecode::SetOpType", "op"
1873
+ func.add_parameter "Gecode::SetVar", "y"
1874
+ func.add_parameter "Gecode::SetRelType", "r"
1875
+ func.add_parameter "Gecode::IntSet", "z"
1876
+ end
1877
+
1878
+ ns.add_function "rel" do |func|
1879
+ func.add_parameter "Gecode::MSpace*", "home"
1880
+ func.add_parameter "Gecode::IntSet", "x"
1881
+ func.add_parameter "Gecode::SetOpType", "op"
1882
+ func.add_parameter "Gecode::SetVar", "y"
1883
+ func.add_parameter "Gecode::SetRelType", "r"
1884
+ func.add_parameter "Gecode::IntSet", "z"
1885
+ end
1886
+
1887
+ ns.add_function "rel" do |func|
1888
+ func.add_parameter "Gecode::MSpace*", "home"
1889
+ func.add_parameter "Gecode::SetVar", "x"
1890
+ func.add_parameter "Gecode::SetOpType", "op"
1891
+ func.add_parameter "Gecode::IntSet", "y"
1892
+ func.add_parameter "Gecode::SetRelType", "r"
1893
+ func.add_parameter "Gecode::IntSet", "z"
1894
+ end
1895
+
1896
+ ns.add_function "rel" do |func|
1897
+ func.add_parameter "Gecode::MSpace*", "home"
1898
+ func.add_parameter "Gecode::SetVar", "x"
1899
+ func.add_parameter "Gecode::SetOpType", "op"
1900
+ func.add_parameter "Gecode::SetVar", "y"
1901
+ func.add_parameter "Gecode::SetRelType", "r"
1902
+ func.add_parameter "Gecode::SetVar", "z"
1903
+ end
1904
+
1905
+
1906
+ ns.add_function "rel" do |func|
1907
+ func.add_parameter "Gecode::MSpace*", "home"
1908
+ func.add_parameter "Gecode::SetOpType", "op"
1909
+ func.add_parameter "Gecode::MSetVarArray", "x" do |param|
1910
+ param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(argv[2], 3)->ptr()"
1911
+ end
1912
+ func.add_parameter "Gecode::SetVar", "y"
1913
+ end
1914
+
1915
+ ns.add_function "rel" do |func|
1916
+ func.add_parameter "Gecode::MSpace*", "home"
1917
+ func.add_parameter "Gecode::SetOpType", "op"
1918
+ func.add_parameter "Gecode::MIntVarArray", "x" do |param|
1919
+ param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[2], 3)->ptr()"
1920
+ end
1921
+ func.add_parameter "Gecode::SetVar", "y"
1922
+ end
1923
+
1924
+ ns.add_function "rel" do |func|
1925
+ func.add_parameter "Gecode::MSpace*", "home"
1926
+ func.add_parameter "Gecode::SetVar", "x"
1927
+ func.add_parameter "Gecode::SetRelType", "r"
1928
+ func.add_parameter "Gecode::SetVar", "y"
1929
+ end
1930
+
1931
+ ns.add_function "rel" do |func|
1932
+ func.add_parameter "Gecode::MSpace*", "home"
1933
+ func.add_parameter "Gecode::SetVar", "x"
1934
+ func.add_parameter "Gecode::SetRelType", "r"
1935
+ func.add_parameter "Gecode::IntVar", "y"
1936
+ end
1937
+
1938
+ ns.add_function "rel" do |func|
1939
+ func.add_parameter "Gecode::MSpace*", "home"
1940
+ func.add_parameter "Gecode::IntVar", "x"
1941
+ func.add_parameter "Gecode::SetRelType", "r"
1942
+ func.add_parameter "Gecode::SetVar", "y"
1943
+ end
1944
+
1945
+ ns.add_function "rel" do |func|
1946
+ func.add_parameter "Gecode::MSpace*", "home"
1947
+ func.add_parameter "Gecode::SetVar", "x"
1948
+ func.add_parameter "Gecode::SetRelType", "r"
1949
+ func.add_parameter "Gecode::SetVar", "y"
1950
+ func.add_parameter "Gecode::BoolVar", "b"
1951
+ end
1952
+
1953
+ ns.add_function "rel" do |func|
1954
+ func.add_parameter "Gecode::MSpace*", "home"
1955
+ func.add_parameter "Gecode::SetVar", "x"
1956
+ func.add_parameter "Gecode::SetRelType", "r"
1957
+ func.add_parameter "Gecode::IntVar", "y"
1958
+ func.add_parameter "Gecode::BoolVar", "b"
1959
+ end
1960
+
1961
+ ns.add_function "rel" do |func|
1962
+ func.add_parameter "Gecode::MSpace*", "home"
1963
+ func.add_parameter "Gecode::IntVar", "x"
1964
+ func.add_parameter "Gecode::SetRelType", "r"
1965
+ func.add_parameter "Gecode::SetVar", "y"
1966
+ func.add_parameter "Gecode::BoolVar", "b"
1967
+ end
1968
+
1969
+ ns.add_function "selectUnion" do |func|
1970
+ func.add_parameter "Gecode::MSpace*", "home"
1971
+ func.add_parameter "Gecode::MSetVarArray", "x" do |param|
1972
+ param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(x, 2)->ptr()"
1973
+ end
1974
+ func.add_parameter "Gecode::SetVar", "y"
1975
+ func.add_parameter "Gecode::SetVar", "z"
1976
+ end
1977
+
1978
+ ns.add_function "selectInter" do |func|
1979
+ func.add_parameter "Gecode::MSpace*", "home"
1980
+ func.add_parameter "Gecode::MSetVarArray", "x" do |param|
1981
+ param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(x, 2)->ptr()"
1982
+ end
1983
+ func.add_parameter "Gecode::SetVar", "y"
1984
+ func.add_parameter "Gecode::SetVar", "z"
1985
+ end
1986
+
1987
+ ns.add_function "selectInterIn" do |func|
1988
+ func.add_parameter "Gecode::MSpace*", "home"
1989
+ func.add_parameter "Gecode::MSetVarArray", "x" do |param|
1990
+ param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(x, 2)->ptr()"
1991
+ end
1992
+ func.add_parameter "Gecode::SetVar", "y"
1993
+ func.add_parameter "Gecode::SetVar", "z"
1994
+ func.add_parameter "Gecode::IntSet", "universe"
1995
+ end
1996
+
1997
+ ns.add_function "selectSet" do |func|
1998
+ func.add_parameter "Gecode::MSpace*", "home"
1999
+ func.add_parameter "Gecode::MSetVarArray", "x" do |param|
2000
+ param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(x, 2)->ptr()"
2001
+ end
2002
+ func.add_parameter "Gecode::IntVar", "y"
2003
+ func.add_parameter "Gecode::SetVar", "z"
2004
+ end
2005
+
2006
+ ns.add_function "selectDisjoint" do |func|
2007
+ func.add_parameter "Gecode::MSpace*", "home"
2008
+ func.add_parameter "Gecode::MSetVarArray", "x" do |param|
2009
+ param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(x, 2)->ptr()"
2010
+ end
2011
+ func.add_parameter "Gecode::SetVar", "y"
2012
+ end
2013
+
2014
+ ns.add_function "sequence" do |func|
2015
+ func.add_parameter "Gecode::MSpace*", "home"
2016
+ func.add_parameter "Gecode::MSetVarArray", "x" do |param|
2017
+ param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(x, 2)->ptr()"
2018
+ end
2019
+ end
2020
+
2021
+ ns.add_function "sequentialUnion" do |func|
2022
+ func.add_parameter "Gecode::MSpace*", "home"
2023
+ func.add_parameter "Gecode::MSetVarArray", "y" do |param|
2024
+ param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(y, 2)->ptr()"
2025
+ end
2026
+ func.add_parameter "Gecode::SetVar", "x"
2027
+ end
2028
+ end
2029
+ end