Class: GecodeRaw::Space
- Inherits:
-
Object
- Object
- GecodeRaw::Space
- Defined in:
- lib/gecoder/interface/binding_changes.rb
Overview
:nodoc: all
Instance Method Summary collapse
-
#bool_var(index) ⇒ Object
Gets the bool variable with the specified index, nil if none exists.
-
#constrain(best_so_far_space) ⇒ Object
Used by Gecode during BAB-search.
-
#int_var(index) ⇒ Object
Gets the int variable with the specified index, nil if none exists.
-
#new_bool_vars(count = 1) ⇒ Object
Creates the specified number of boolean variables in the space.
-
#new_int_vars(domain, count = 1) ⇒ Object
Creates the specified number of integer variables in the space with the specified domain.
-
#new_set_vars(*vars) ⇒ Object
Creates the specified number of set variables in the space with the specified domain for greatest lower bound and least upper bound (specified as either a range or enum).
-
#refresh ⇒ Object
Refreshes the underlying stores used by the space.
-
#set_var(index) ⇒ Object
Gets the set variable with the specified index, nil if none exists.
Instance Method Details
#bool_var(index) ⇒ Object
Gets the bool variable with the specified index, nil if none exists.
31 32 33 |
# File 'lib/gecoder/interface/binding_changes.rb', line 31 def bool_var(index) bool_var_store[index] end |
#constrain(best_so_far_space) ⇒ Object
Used by Gecode during BAB-search.
51 52 53 |
# File 'lib/gecoder/interface/binding_changes.rb', line 51 def constrain(best_so_far_space) Gecode::Model.constrain(self, best_so_far_space) end |
#int_var(index) ⇒ Object
Gets the int variable with the specified index, nil if none exists.
20 21 22 |
# File 'lib/gecoder/interface/binding_changes.rb', line 20 def int_var(index) int_var_store[index] end |
#new_bool_vars(count = 1) ⇒ Object
Creates the specified number of boolean variables in the space. Returns the indices with which they can then be accessed using bool_var.
26 27 28 |
# File 'lib/gecoder/interface/binding_changes.rb', line 26 def new_bool_vars(count = 1) bool_var_store.new_vars(count) end |
#new_int_vars(domain, count = 1) ⇒ Object
Creates the specified number of integer variables in the space with the specified domain. Returns the indices with which they can then be accessed using int_var. The domain can be given as a Range (trated specially) or as another enum.
15 16 17 |
# File 'lib/gecoder/interface/binding_changes.rb', line 15 def new_int_vars(domain, count = 1) int_var_store.new_vars(domain, count) end |
#new_set_vars(*vars) ⇒ Object
Creates the specified number of set variables in the space with the specified domain for greatest lower bound and least upper bound (specified as either a range or enum). A range for the allowed cardinality of the set can also be specified, if none is specified, or nil is given, then the default range (anything) will be used. Returns the indices with which they can then be accessed using set_var.
41 42 43 |
# File 'lib/gecoder/interface/binding_changes.rb', line 41 def new_set_vars(*vars) set_var_store.new_vars(*vars) end |
#refresh ⇒ Object
Refreshes the underlying stores used by the space.
56 57 58 59 60 |
# File 'lib/gecoder/interface/binding_changes.rb', line 56 def refresh @int_var_store = nil @bool_var_store = nil @set_var_store = nil end |
#set_var(index) ⇒ Object
Gets the set variable with the specified index, nil if none exists.
46 47 48 |
# File 'lib/gecoder/interface/binding_changes.rb', line 46 def set_var(index) set_var_store[index] end |