Class: Gecode::BoolVar

Inherits:
Object
  • Object
show all
Includes:
Gecode::Bool::BoolOperand
Defined in:
lib/gecoder/interface/variables.rb

Overview

Describes a boolean variable.

A boolean variable can be either true or false.

Boolean variables are boolean operands and hence respond to everything that Gecode::Bool::BoolOperand responds to. Any constraint found in Gecode::Bool::BoolConstraintReceiver can thereby be placed on boolean variables.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gecode::Bool::BoolOperand

#&, #*, #+, #-, #^, #implies, #method_missing, #|

Methods included from Operand

#must, #must_not

Methods included from Gecode::Bool::BoolLinearOperations

#*, #+, #-

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Gecode::Bool::BoolOperand

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



154
155
156
# File 'lib/gecoder/interface/variables.rb', line 154

def model
  @model
end

Instance Method Details

#to_bool_varObject

Returns the receiver.



167
168
169
# File 'lib/gecoder/interface/variables.rb', line 167

def to_bool_var
  self
end

#valueObject

Gets the values in the assigned boolean variable (true or false). The variable must be assigned, if it isn’t then a RuntimeError is raised.



161
162
163
164
# File 'lib/gecoder/interface/variables.rb', line 161

def value
  raise 'No value is assigned.' unless assigned?
  send_bound(:val) == 1
end