Class: Gecode::ReifiableConstraint

Inherits:
Constraint show all
Defined in:
lib/gecoder/interface/constraints/reifiable_constraints.rb

Overview

Base class for all reifiable constraints.

Instance Method Summary collapse

Methods inherited from Constraint

#initialize, #post

Constructor Details

This class inherits a constructor from Gecode::Constraint

Instance Method Details

#&(constraint) ⇒ Object

Produces a conjunction of two reifiable constraints, producing a new reifiable constraint.



26
27
28
29
30
31
# File 'lib/gecoder/interface/constraints/reifiable_constraints.rb', line 26

def &(constraint)
  with_reification_operands(constraint) do |b1, b2|
    # Create the conjunction constraint.
    (b1 & b2).must_be.true
  end
end

#reification_varObject

Gets the reification operand of the constraint, nil if none exists.



5
6
7
# File 'lib/gecoder/interface/constraints/reifiable_constraints.rb', line 5

def reification_var
  @params[:reif]
end

#reification_var=(new_var) ⇒ Object

Sets the reification operand of the constraint, nil if none should be used.



11
12
13
# File 'lib/gecoder/interface/constraints/reifiable_constraints.rb', line 11

def reification_var=(new_var)
  @params[:reif] = new_var
end

#|(constraint) ⇒ Object

Produces a disjunction of two reifiable constraints, producing a new reifiable constraint.



17
18
19
20
21
22
# File 'lib/gecoder/interface/constraints/reifiable_constraints.rb', line 17

def |(constraint)
  with_reification_operands(constraint) do |b1, b2|
    # Create the disjunction constraint.
    (b1 | b2).must_be.true
  end
end