Class: Gecode::FreeVarBase
- Inherits:
-
Object
- Object
- Gecode::FreeVarBase
- Defined in:
- lib/gecoder/interface/variables.rb
Overview
Describes a variable that is bound to a model, but not to a particular space.
Instance Attribute Summary collapse
-
#model ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#cached? ⇒ Boolean
Checks whether the variable is cached, i.e.
-
#initialize(model, index) ⇒ FreeVarBase
constructor
Creates an int variable with the specified index.
- #inspect ⇒ Object
-
#refresh ⇒ Object
Forces the variable to refresh itself.
Constructor Details
#initialize(model, index) ⇒ FreeVarBase
Creates an int variable with the specified index.
8 9 10 11 12 13 |
# File 'lib/gecoder/interface/variables.rb', line 8 def initialize(model, index) @model = model @index = index @bound_space = @bound_var = nil model.track_variable(self) end |
Instance Attribute Details
#model ⇒ Object
:nodoc:
5 6 7 |
# File 'lib/gecoder/interface/variables.rb', line 5 def model @model end |
Instance Method Details
#cached? ⇒ Boolean
Checks whether the variable is cached, i.e. whether it needs to be rebound after changes to a space.
17 18 19 |
# File 'lib/gecoder/interface/variables.rb', line 17 def cached? not @bound_space.nil? end |
#inspect ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/gecoder/interface/variables.rb', line 26 def inspect if assigned? "#<#{self.class} #{domain}>" else "#<#{self.class} #{domain}>" end end |
#refresh ⇒ Object
Forces the variable to refresh itself.
22 23 24 |
# File 'lib/gecoder/interface/variables.rb', line 22 def refresh @bound_space = nil end |