gecoder 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/CHANGES +6 -0
  2. data/README +1 -1
  3. data/THANKS +18 -0
  4. data/example/equation_system.rb +3 -1
  5. data/example/magic_sequence.rb +3 -1
  6. data/example/queens.rb +3 -1
  7. data/example/send_more_money.rb +24 -30
  8. data/example/send_most_money.rb +15 -26
  9. data/example/square_tiling.rb +3 -1
  10. data/example/sudoku-set.rb +3 -1
  11. data/lib/gecoder/bindings.rb +7 -5
  12. data/lib/gecoder/bindings/bindings.rb +8 -8
  13. data/lib/gecoder/interface.rb +4 -2
  14. data/lib/gecoder/interface/binding_changes.rb +1 -1
  15. data/lib/gecoder/interface/branch.rb +1 -1
  16. data/lib/gecoder/interface/constraints/bool_enum_constraints.rb +4 -4
  17. data/lib/gecoder/interface/constraints/bool_var_constraints.rb +2 -2
  18. data/lib/gecoder/interface/constraints/extensional_regexp.rb +1 -1
  19. data/lib/gecoder/interface/constraints/fixnum_enum_constraints.rb +2 -2
  20. data/lib/gecoder/interface/constraints/int_enum/extensional.rb +5 -5
  21. data/lib/gecoder/interface/constraints/int_enum_constraints.rb +4 -4
  22. data/lib/gecoder/interface/constraints/int_var_constraints.rb +2 -2
  23. data/lib/gecoder/interface/constraints/selected_set/select.rb +8 -8
  24. data/lib/gecoder/interface/constraints/set_enum/{select.rb → element.rb} +10 -10
  25. data/lib/gecoder/interface/constraints/set_enum_constraints.rb +5 -5
  26. data/lib/gecoder/interface/constraints/set_var_constraints.rb +2 -2
  27. data/lib/gecoder/interface/{model_sugar.rb → convenience.rb} +19 -4
  28. data/lib/gecoder/interface/enum_wrapper.rb +1 -1
  29. data/lib/gecoder/interface/{model.rb → mixin.rb} +93 -60
  30. data/lib/gecoder/interface/search.rb +23 -22
  31. data/lib/gecoder/version.rb +1 -1
  32. data/specs/branch.rb +5 -3
  33. data/specs/constraints/bool/boolean.rb +3 -1
  34. data/specs/constraints/bool/linear.rb +3 -1
  35. data/specs/constraints/bool_enum/bool_enum_relation.rb +3 -1
  36. data/specs/constraints/bool_enum/channel.rb +3 -1
  37. data/specs/constraints/fixnum_enum/element.rb +3 -1
  38. data/specs/constraints/int/arithmetic.rb +3 -1
  39. data/specs/constraints/int/channel.rb +3 -1
  40. data/specs/constraints/int/linear.rb +3 -1
  41. data/specs/constraints/int/linear_properties.rb +3 -1
  42. data/specs/constraints/int_enum/arithmetic.rb +3 -1
  43. data/specs/constraints/int_enum/channel.rb +3 -1
  44. data/specs/constraints/int_enum/count.rb +3 -1
  45. data/specs/constraints/int_enum/distinct.rb +3 -1
  46. data/specs/constraints/int_enum/element.rb +3 -1
  47. data/specs/constraints/int_enum/sort.rb +3 -1
  48. data/specs/constraints/property_helper.rb +10 -10
  49. data/specs/constraints/reification_sugar.rb +3 -1
  50. data/specs/constraints/selected_set/select.rb +6 -5
  51. data/specs/constraints/selected_set/select_properties.rb +12 -10
  52. data/specs/constraints/set/channel.rb +3 -1
  53. data/specs/constraints/set/domain.rb +4 -4
  54. data/specs/constraints/set/relation.rb +4 -4
  55. data/specs/constraints/set_enum/channel.rb +3 -1
  56. data/specs/constraints/set_enum/distinct.rb +3 -1
  57. data/specs/constraints/set_enum/{select.rb → element.rb} +13 -9
  58. data/specs/enum_wrapper.rb +1 -1
  59. data/specs/mixin.rb +78 -0
  60. data/specs/model.rb +5 -5
  61. data/specs/search.rb +20 -14
  62. data/specs/selected_set.rb +3 -3
  63. data/specs/set_elements.rb +2 -2
  64. data/tasks/distribution.rake +25 -4
  65. metadata +15 -12
  66. data/example/money.rb +0 -36
@@ -5,19 +5,19 @@ module Gecode::IntEnum #:nodoc:
5
5
  # constraints defined in IntEnumConstraintReceiver can be placed.
6
6
  #
7
7
  # Enumerations of integer operands can be created either by using
8
- # Gecode::Model#int_var_array and Gecode::Model#int_var_matrix, or
8
+ # Gecode::Mixin#int_var_array and Gecode::Mixin#int_var_matrix, or
9
9
  # by wrapping an existing enumeration containing IntOperand using
10
- # Gecode::Model#wrap_enum. The enumerations, no matter how they were
10
+ # Gecode::Mixin#wrap_enum. The enumerations, no matter how they were
11
11
  # created, all respond to the properties defined by IntEnumOperand.
12
12
  #
13
13
  # ==== Examples
14
14
  #
15
15
  # Produces an array of five int operands with domain 0..9 inside a
16
- # problem formulation using Gecode::Model#int_var_array:
16
+ # problem formulation using Gecode::Mixin#int_var_array:
17
17
  #
18
18
  # int_enum = int_var_array(5, 0..9)
19
19
  #
20
- # Uses Gecode::Model#wrap_enum inside a problem formulation to create
20
+ # Uses Gecode::Mixin#wrap_enum inside a problem formulation to create
21
21
  # a IntEnumOperand from an existing enumeration containing the
22
22
  # integer operands +int_operand1+ and +int_operand2+:
23
23
  #
@@ -5,7 +5,7 @@ module Gecode::Int #:nodoc:
5
5
  # constraints defined in IntConstraintReceiver can be placed.
6
6
  #
7
7
  # Integer operands can be created either by using
8
- # Gecode::Model#int_var et al, or by using properties that produce
8
+ # Gecode::Mixin#int_var et al, or by using properties that produce
9
9
  # integer operands. The operands, no matter how they were created,
10
10
  # all respond to the properties defined by IntOperand.
11
11
  #
@@ -13,7 +13,7 @@ module Gecode::Int #:nodoc:
13
13
  #
14
14
  # Produces a single integer operand (more specifically an IntVar) with
15
15
  # domain 0..9 inside a problem formulation, using
16
- # Gecode::Model#int_var:
16
+ # Gecode::Mixin#int_var:
17
17
  #
18
18
  # int_operand = int_var(0..9)
19
19
  #
@@ -7,7 +7,7 @@ module Gecode::SelectedSet
7
7
  # # The union of all sets selected by +set_enum[set]+.
8
8
  # set_enum[set].union
9
9
  def union
10
- Select::SelectedSetUnionOperand.new(model, self)
10
+ Element::SelectedSetUnionOperand.new(model, self)
11
11
  end
12
12
 
13
13
  # Produces a SetOperand representing the selected sets' intersection.
@@ -36,7 +36,7 @@ module Gecode::SelectedSet
36
36
  end
37
37
  end
38
38
 
39
- Select::SelectedSetIntersectionOperand.new(model, self, universe)
39
+ Element::SelectedSetIntersectionOperand.new(model, self, universe)
40
40
  end
41
41
  end
42
42
 
@@ -59,11 +59,11 @@ module Gecode::SelectedSet
59
59
  end
60
60
 
61
61
  @params.update Gecode::Set::Util.decode_options(options)
62
- @model.add_constraint Select::DisjointConstraint.new(@model, @params)
62
+ @model.add_constraint Element::DisjointConstraint.new(@model, @params)
63
63
  end
64
64
  end
65
65
 
66
- module Select #:nodoc:
66
+ module Element #:nodoc:
67
67
  class SelectedSetUnionOperand < Gecode::Set::ShortCircuitEqualityOperand #:nodoc:
68
68
  def initialize(model, selected_set)
69
69
  super model
@@ -76,7 +76,7 @@ module Gecode::SelectedSet
76
76
  set_operand.must_be.subset_of enum.upper_bound_range
77
77
  end
78
78
 
79
- Gecode::Raw::selectUnion(@model.active_space,
79
+ Gecode::Raw::elementsUnion(@model.active_space,
80
80
  enum.to_set_enum.bind_array, indices.to_set_var.bind,
81
81
  set_operand.to_set_var.bind)
82
82
  end
@@ -97,11 +97,11 @@ module Gecode::SelectedSet
97
97
  # is the universe.
98
98
 
99
99
  if universe.nil?
100
- Gecode::Raw::selectInter(@model.active_space,
100
+ Gecode::Raw::elementsInter(@model.active_space,
101
101
  enum.to_set_enum.bind_array, indices.to_set_var.bind,
102
102
  set_operand.to_set_var.bind)
103
103
  else
104
- Gecode::Raw::selectInterIn(@model.active_space,
104
+ Gecode::Raw::elementsInter(@model.active_space,
105
105
  enum.to_set_enum.bind_array, indices.to_set_var.bind,
106
106
  set_operand.to_set_var.bind,
107
107
  Gecode::Util.constant_set_to_int_set(universe))
@@ -112,7 +112,7 @@ module Gecode::SelectedSet
112
112
  class DisjointConstraint < Gecode::Constraint #:nodoc:
113
113
  def post
114
114
  enum, indices = @params[:lhs].to_selected_set
115
- Gecode::Raw.selectDisjoint(@model.active_space,
115
+ Gecode::Raw.elementsDisjoint(@model.active_space,
116
116
  enum.to_set_enum.bind_array, indices.to_set_var.bind)
117
117
  end
118
118
  end
@@ -7,14 +7,14 @@ module Gecode::SetEnum
7
7
  mod.module_eval do
8
8
  # Now we enter the module SetEnumOperands is mixed into.
9
9
  class << self
10
- alias_method :pre_selection_included, :included
10
+ alias_method :pre_set_element_included, :included
11
11
  def included(mod) #:nodoc:
12
12
  mod.module_eval do
13
13
  # Now we enter the module that the module possibly defining #[]
14
14
  # is mixed into.
15
15
  if instance_methods.include?('[]') and
16
- not instance_methods.include?('pre_selection_access')
17
- alias_method :pre_selection_access, :[]
16
+ not instance_methods.include?('pre_set_element_access')
17
+ alias_method :pre_set_element_access, :[]
18
18
  end
19
19
 
20
20
  # Produces a SetOperand representing the i:th set
@@ -38,27 +38,27 @@ module Gecode::SetEnum
38
38
  # Hook in an element constraint if a operand is used for array
39
39
  # access.
40
40
  if vars.first.respond_to? :to_int_var
41
- Select::SelectSetOperand.new(
41
+ Element::ElementSetOperand.new(
42
42
  model, self, vars.first)
43
43
  elsif vars.first.respond_to? :to_set_var
44
44
  Gecode::SelectedSet::SelectedSetOperand.new(
45
45
  self, vars.first)
46
46
  else
47
- if respond_to? :pre_selection_access
48
- pre_selection_access(*vars)
47
+ if respond_to? :pre_set_element_access
48
+ pre_set_element_access(*vars)
49
49
  end
50
50
  end
51
51
  end
52
52
  end
53
- pre_selection_included(mod)
53
+ pre_set_element_included(mod)
54
54
  end
55
55
  end
56
56
  end
57
57
  end
58
58
  end
59
59
 
60
- module Select #:nodoc:
61
- class SelectSetOperand < Gecode::Set::ShortCircuitEqualityOperand #:nodoc:
60
+ module Element #:nodoc:
61
+ class ElementSetOperand < Gecode::Set::ShortCircuitEqualityOperand #:nodoc:
62
62
  def initialize(model, enum_op, position_int_op)
63
63
  super model
64
64
  @enum = enum_op
@@ -71,7 +71,7 @@ module Gecode::SetEnum
71
71
  set_operand.must_be.subset_of enum.upper_bound_range
72
72
  end
73
73
 
74
- Gecode::Raw::selectSet(@model.active_space, enum.bind_array,
74
+ Gecode::Raw::element(@model.active_space, enum.bind_array,
75
75
  @position.to_int_var.bind, set_operand.to_set_var.bind)
76
76
  end
77
77
  end
@@ -5,20 +5,20 @@ module Gecode::SetEnum #:nodoc:
5
5
  # constraints defined in SetEnumConstraintReceiver can be placed.
6
6
  #
7
7
  # Enumerations of set operands can be created either by using
8
- # Gecode::Model#set_var_array and Gecode::Model#set_var_matrix, or
8
+ # Gecode::Mixin#set_var_array and Gecode::Mixin#set_var_matrix, or
9
9
  # by wrapping an existing enumeration containing SetOperand using
10
- # Gecode::Model#wrap_enum. The enumerations, no matter how they were
10
+ # Gecode::Mixin#wrap_enum. The enumerations, no matter how they were
11
11
  # created, all respond to the properties defined by SetEnumOperand.
12
12
  #
13
13
  # ==== Examples
14
14
  #
15
15
  # Produces an array of five set operands, with greatest lower bound
16
16
  # {0} and least upper bound {0, 1, 2}, inside a problem formulation
17
- # using Gecode::Model#set_var_array:
17
+ # using Gecode::Mixin#set_var_array:
18
18
  #
19
19
  # set_enum = set_var_array(5, 0, 1..2)
20
20
  #
21
- # Uses Gecode::Model#wrap_enum inside a problem formulation to create
21
+ # Uses Gecode::Mixin#wrap_enum inside a problem formulation to create
22
22
  # a SetEnumOperand from an existing enumeration containing the
23
23
  # set operands +set_operand1+ and +set_operand2+:
24
24
  #
@@ -80,5 +80,5 @@ end
80
80
 
81
81
  require 'gecoder/interface/constraints/set_enum/channel'
82
82
  require 'gecoder/interface/constraints/set_enum/distinct'
83
- require 'gecoder/interface/constraints/set_enum/select'
83
+ require 'gecoder/interface/constraints/set_enum/element'
84
84
  require 'gecoder/interface/constraints/set_enum/operation'
@@ -4,7 +4,7 @@ module Gecode::Set #:nodoc:
4
4
  # A SetOperand is a combination of operands on which the
5
5
  # constraints defined in SetConstraintReceiver can be placed.
6
6
  #
7
- # Set operands can be created either by using Gecode::Model#set_var et
7
+ # Set operands can be created either by using Gecode::Mixin#set_var et
8
8
  # al, or by using properties that produce set operands. The operands,
9
9
  # no matter how they were created, all respond to the properties
10
10
  # defined by SetOperand.
@@ -13,7 +13,7 @@ module Gecode::Set #:nodoc:
13
13
  #
14
14
  # Produces a single set operand (more specifically a SetVar), with
15
15
  # greatest lower bound {0} and least upper bound {0, 1, 2}, inside a
16
- # problem formulation, using Gecode::Model#set_var:
16
+ # problem formulation, using Gecode::Mixin#set_var:
17
17
  #
18
18
  # set_operand = set_var(0, 0..2)
19
19
  #
@@ -1,4 +1,11 @@
1
1
  module Gecode
2
+ # A convenient class that just includes Gecode::Mixin. Can be useful
3
+ # when you don't want to create your own class that mixes in
4
+ # Gecode::Mixin.
5
+ class Model
6
+ include Gecode::Mixin
7
+ end
8
+
2
9
  # Provides a convenient way to construct a model and then find a
3
10
  # solution. The model constructed uses the specified block as
4
11
  # initialization method. The first solution to the model is then
@@ -12,7 +19,9 @@ module Gecode
12
19
  #
13
20
  # is equivalent to
14
21
  #
15
- # class Foo < Gecode::Model
22
+ # class Foo
23
+ # include Gecode::Mixin
24
+ #
16
25
  # def initialize
17
26
  # # Do something
18
27
  # end
@@ -35,7 +44,9 @@ module Gecode
35
44
  #
36
45
  # is equivalent to
37
46
  #
38
- # class Foo < Gecode::Model
47
+ # class Foo
48
+ # include Gecode::Mixin
49
+ #
39
50
  # def initialize
40
51
  # # Do something
41
52
  # end
@@ -58,7 +69,9 @@ module Gecode
58
69
  #
59
70
  # is equivalent to
60
71
  #
61
- # class Foo < Gecode::Model
72
+ # class Foo
73
+ # include Gecode::Mixin
74
+ #
62
75
  # def initialize
63
76
  # # Do something
64
77
  # end
@@ -73,8 +86,10 @@ module Gecode
73
86
  # Creates an instance of a class that subclasses Model and uses the
74
87
  # specified block as initialization method.
75
88
  def self.create_model(&block)
76
- model = Class.new(Gecode::Model)
89
+ model = Class.new
77
90
  model.class_eval do
91
+ include Gecode::Mixin
92
+
78
93
  def initialize(&init_block) #:nodoc:
79
94
  instance_eval &init_block
80
95
  end
@@ -1,5 +1,5 @@
1
1
  module Gecode
2
- class Model
2
+ module Mixin
3
3
  # Wraps a custom enumerable so that constraints can be specified using it.
4
4
  # The argument is altered and returned.
5
5
  def wrap_enum(enum)
@@ -1,11 +1,13 @@
1
1
  module Gecode
2
- # Model is the base class that all models must inherit from.
2
+ # Mixin contains the base functionality needed to formulate problems.
3
3
  #
4
4
  # == Formulating problems
5
5
  #
6
- # Models are used to formulate the problems that Gecode should solve.
7
- # Below is an example of a model that formulates the problem of finding
8
- # a solution to the following equation system.
6
+ # Problems are formulated by building a model that represents the
7
+ # problem. A model is a class that mixes in Mixin and uses its
8
+ # functionality to define variables and constraints that describe the
9
+ # problem. Below is an example of a model that formulates the problem
10
+ # of finding a solution to the following equation system.
9
11
  #
10
12
  # Equation system:
11
13
  # x + y = z
@@ -13,7 +15,9 @@ module Gecode
13
15
  # 0 <= x,y,z <= 9
14
16
  #
15
17
  # Model:
16
- # class EquationProblem < Gecode::Model
18
+ # class EquationProblem
19
+ # include Gecode::Mixin
20
+ #
17
21
  # attr :vars
18
22
  #
19
23
  # def initialize
@@ -97,7 +101,9 @@ module Gecode
97
101
  # Additionally one can use "foo_is_an ..." to create an accessor of
98
102
  # name foo, without having to use instance variables. The above
99
103
  # problem becomes
100
- # class EquationProblem < Gecode::Model
104
+ # class EquationProblem
105
+ # include Gecode::Mixin
106
+ #
101
107
  # def initialize
102
108
  # x, y, z = vars_is_an int_var_array(3, 0..9)
103
109
  #
@@ -108,7 +114,7 @@ module Gecode
108
114
  # end
109
115
  # end
110
116
  #
111
- class Model
117
+ module Mixin
112
118
  # The largest integer allowed in the domain of an integer variable.
113
119
  MAX_INT = Gecode::Raw::IntLimits::MAX
114
120
  # The smallest integer allowed in the domain of an integer variable.
@@ -221,7 +227,7 @@ module Gecode
221
227
  # The space returned by this method should never be stored, it should be
222
228
  # rerequested from the model every time that it's needed.
223
229
  def active_space #:nodoc:
224
- unless @allow_space_access
230
+ unless @gecoder_mixin_allow_space_access
225
231
  raise 'Space access is restricted and the permission to access the ' +
226
232
  'space has not been given.'
227
233
  end
@@ -253,63 +259,90 @@ module Gecode
253
259
  # We store the old value so that nested calls don't become a problem, i.e.
254
260
  # access is allowed as long as one call to this method is still on the
255
261
  # stack.
256
- old = @allow_space_access
257
- @allow_space_access = true
262
+ old = @gecoder_mixin_allow_space_access
263
+ @gecoder_mixin_allow_space_access = true
258
264
  res = yield
259
- @allow_space_access = old
265
+ @gecoder_mixin_allow_space_access = old
260
266
  return res
261
267
  end
262
268
 
263
269
  # Starts tracking a variable that depends on the space. All variables
264
270
  # created should call this method for their respective models.
265
271
  def track_variable(variable) #:nodoc:
266
- (@variables ||= []) << variable
272
+ (@gecoder_mixin_variables ||= []) << variable
267
273
  end
268
274
 
269
- # Wraps method missing to handle #foo_is_a and #foo_is_an .
270
- #
271
- # "<variable_name>_is_a <variable>" or "<variable_name>_is_an <variable>",
272
- # replacing "<variable_name>" with the variable's name and
273
- # "<variable>" with the variable, adds an instance variable and
274
- # accessor with the specified name.
275
- #
276
- # The method also returns the variable given.
277
- #
278
- # ==== Example
279
- #
280
- # # Add an instance variable and accessor named "foo" that return
281
- # # the integer variable.
282
- # foo_is_an int_var(0..9)
283
- #
284
- # # Add an instance variable and accessor named "bar" that return
285
- # # the boolean variable array.
286
- # bar_is_a bool_var_array(2)
287
- def method_missing(name_symbol, *args)
288
- name = name_symbol.to_s
289
- if name =~ /._is_an?$/
290
- name.sub!(/_is_an?$/, '')
291
- unless args.size == 1
292
- raise ArgumentError, "Wrong number of argmuments (#{args.size} for 1)."
293
- end
294
- if respond_to? name
295
- raise ArgumentError, "Method with name #{name} already exists."
296
- end
297
- if instance_variable_defined? "@#{name}"
298
- raise ArgumentError,
299
- "Instance variable with name @#{name} already exists."
275
+ def self.included(mod)
276
+ mod.class_eval do
277
+ alias_method :pre_gecoder_method_missing, :method_missing
278
+ # Wraps method missing to handle #foo_is_a and #foo_is_an .
279
+ #
280
+ # "<variable_name>_is_a <variable>" or "<variable_name>_is_an
281
+ # <variable>", # replacing "<variable_name>" with the variable's
282
+ # name and "<variable>" with the variable, adds an instance
283
+ # variable and accessor with the specified name.
284
+ #
285
+ # The method also returns the variable given.
286
+ #
287
+ # ==== Example
288
+ #
289
+ # # Add an instance variable and accessor named "foo" that return
290
+ # # the integer variable.
291
+ # foo_is_an int_var(0..9)
292
+ #
293
+ # # Add an instance variable and accessor named "bar" that return
294
+ # # the boolean variable array.
295
+ # bar_is_a bool_var_array(2)
296
+ def method_missing(method, *args)
297
+ name = method.to_s
298
+ if name =~ /._is_an?$/
299
+ name.sub!(/_is_an?$/, '')
300
+ unless args.size == 1
301
+ raise ArgumentError,
302
+ "Wrong number of argmuments (#{args.size} for 1)."
303
+ end
304
+ if respond_to? name
305
+ raise ArgumentError, "Method with name #{name} already exists."
306
+ end
307
+ if instance_variable_defined? "@#{name}"
308
+ raise ArgumentError,
309
+ "Instance variable with name @#{name} already exists."
310
+ end
311
+
312
+ # We use the meta class to avoid defining the variable in all
313
+ # other instances of the class.
314
+ eval <<-"end_eval"
315
+ @#{name} = args.first
316
+ class <<self
317
+ attr :#{name}
318
+ end
319
+ end_eval
320
+ return args.first
321
+ else
322
+ pre_gecoder_method_missing(method, *args)
323
+ end
300
324
  end
325
+ alias_method :mixin_method_missing, :method_missing
301
326
 
302
- # We use the meta class to avoid defining the variable in all
303
- # other instances of the class.
304
- eval <<-"end_eval"
305
- @#{name} = args.first
306
- class <<self
307
- attr :#{name}
327
+ def self.method_added(method)
328
+ if method == :method_missing && !@redefining_method_missing
329
+ # The class that is mixing in the mixin redefined method
330
+ # missing. Redefine method missing again to combine the two
331
+ # definitions.
332
+ @redefining_method_missing = true
333
+ class_eval do
334
+ alias_method :mixee_method_missing, :method_missing
335
+ def combined_method_missing(*args)
336
+ begin
337
+ mixin_method_missing(*args)
338
+ rescue NoMethodError => e
339
+ mixee_method_missing(*args)
340
+ end
341
+ end
342
+ alias_method :method_missing, :combined_method_missing
343
+ end
308
344
  end
309
- end_eval
310
- return args.first
311
- else
312
- super
345
+ end
313
346
  end
314
347
  end
315
348
 
@@ -419,19 +452,19 @@ module Gecode
419
452
 
420
453
  # Retrieves the base from which searches are made.
421
454
  def base_space
422
- @base_space ||= Gecode::Raw::Space.new
455
+ @gecoder_mixin_base_space ||= Gecode::Raw::Space.new
423
456
  end
424
457
 
425
458
  # Retrieves the currently selected space, the one which constraints and
426
459
  # variables should be bound to.
427
460
  def selected_space
428
- return @active_space unless @active_space.nil?
461
+ return @gecoder_mixin_active_space unless @gecoder_mixin_active_space.nil?
429
462
  self.active_space = base_space
430
463
  end
431
464
 
432
465
  # Retrieves the space that should be used for variable creation.
433
466
  def variable_creation_space
434
- @variable_creation_space || selected_space
467
+ @gecoder_mixin_variable_creation_space || selected_space
435
468
  end
436
469
 
437
470
  # Executes any interactions with Gecode still waiting in the queue
@@ -444,10 +477,10 @@ module Gecode
444
477
  end
445
478
 
446
479
  # Switches the active space used (the space from which variables are read
447
- # and to which constraints are posted). @active_space should never be
448
- # assigned directly.
480
+ # and to which constraints are posted). @gecoder_mixin_active_space
481
+ # should never be assigned directly.
449
482
  def active_space=(new_space)
450
- @active_space = new_space
451
- end
483
+ @gecoder_mixin_active_space = new_space
484
+ end
452
485
  end
453
486
  end