Class: Gecode::Constraints::Bool::CompositeExpression
- Inherits:
-
CompositeExpression
- Object
- Expression
- CompositeExpression
- Gecode::Constraints::Bool::CompositeExpression
- Defined in:
- lib/gecoder/interface/constraints/bool_var_constraints.rb
Overview
A composite expression which is an bool expression with a left hand side resulting from a previous constraint.
Instance Method Summary collapse
-
#false(options = {}) ⇒ Object
Override to also deal with constant booleans.
-
#initialize(model, params, &block) ⇒ CompositeExpression
constructor
The block given should take three parameters.
-
#true(options = {}) ⇒ Object
Override to also deal with constant booleans.
Methods inherited from CompositeExpression
Constructor Details
#initialize(model, params, &block) ⇒ CompositeExpression
The block given should take three parameters. The first is the variable that should be the left hand side, if it’s nil then a new one should be created. The second is the has of parameters. The block should return the variable used as left hand side.
28 29 30 31 |
# File 'lib/gecoder/interface/constraints/bool_var_constraints.rb', line 28 def initialize(model, params, &block) super(Expression, Gecode::FreeBoolVar, lambda{ model.bool_var }, model, params, &block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Gecode::Constraints::CompositeExpression
Instance Method Details
#false(options = {}) ⇒ Object
Override to also deal with constant booleans.
43 44 45 46 47 48 49 |
# File 'lib/gecoder/interface/constraints/bool_var_constraints.rb', line 43 def false( = {}) # We don't need any additional constraints. @params.update Gecode::Constraints::Util.() @model.add_interaction do @constrain_equal_proc.call(@params[:negate], @params) end end |
#true(options = {}) ⇒ Object
Override to also deal with constant booleans.
34 35 36 37 38 39 40 |
# File 'lib/gecoder/interface/constraints/bool_var_constraints.rb', line 34 def true( = {}) # We don't need any additional constraints. @params.update Gecode::Constraints::Util.() @model.add_interaction do @constrain_equal_proc.call(!@params[:negate], @params) end end |