Class: Gecode::Constraints::Bool::Expression
- Inherits:
-
Expression
- Object
- Expression
- Gecode::Constraints::Bool::Expression
- Defined in:
- lib/gecoder/interface/constraints/bool/boolean.rb,
lib/gecoder/interface/constraints/bool/channel.rb,
lib/gecoder/interface/constraints/bool_var_constraints.rb
Overview
Describes a boolean expression.
Instance Method Summary collapse
-
#==(expression, options = {}) ⇒ Object
:nodoc:.
-
#false(options = {}) ⇒ Object
Constrains the boolean expression to be false.
-
#imply(expression, options = {}) ⇒ Object
Constrains the boolean expression to imply the specified expression.
-
#true(options = {}) ⇒ Object
Constrains the boolean expression to be true.
Methods inherited from Expression
Constructor Details
This class inherits a constructor from Gecode::Constraints::Expression
Instance Method Details
#==(expression, options = {}) ⇒ Object
:nodoc:
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/gecoder/interface/constraints/bool/boolean.rb', line 28 def ==(expression, = {}) if expression.kind_of? Gecode::Constraints::Int::Linear::ExpressionTree return expression.must == @params[:lhs] end unless expression.respond_to? :to_minimodel_bool_expr expression = Constraints::Bool::ExpressionNode.new(expression, @model) end @params.update Gecode::Constraints::Util.() @params.update(:lhs => @params[:lhs], :rhs => expression) @model.add_constraint BooleanConstraint.new(@model, @params) end |
#false(options = {}) ⇒ Object
Constrains the boolean expression to be false.
56 57 58 59 |
# File 'lib/gecoder/interface/constraints/bool/boolean.rb', line 56 def false( = {}) @params[:negate] = !@params[:negate] self.true end |
#imply(expression, options = {}) ⇒ Object
Constrains the boolean expression to imply the specified expression.
42 43 44 45 46 |
# File 'lib/gecoder/interface/constraints/bool/boolean.rb', line 42 def imply(expression, = {}) @params.update Gecode::Constraints::Util.() @params.update(:lhs => @params[:lhs].implies(expression), :rhs => true) @model.add_constraint BooleanConstraint.new(@model, @params) end |
#true(options = {}) ⇒ Object
Constrains the boolean expression to be true.
49 50 51 52 53 |
# File 'lib/gecoder/interface/constraints/bool/boolean.rb', line 49 def true( = {}) @params.update Gecode::Constraints::Util.() @model.add_constraint BooleanConstraint.new(@model, @params.update(:rhs => true)) end |