Class: ORTools::CpModel
- Inherits:
-
Object
- Object
- ORTools::CpModel
- Defined in:
- lib/or_tools/cp_model.rb
Instance Method Summary collapse
Instance Method Details
#add(comparison) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/or_tools/cp_model.rb', line 3 def add(comparison) method_name = case comparison.operator when "==" :add_equality when "!=" :add_not_equal when ">" :add_greater_than when ">=" :add_greater_or_equal when "<" :add_less_than when "<=" :add_less_or_equal else raise ArgumentError, "Unknown operator: #{comparison.operator}" end send(method_name, comparison.left, comparison.right) end |
#inspect ⇒ Object
29 30 31 |
# File 'lib/or_tools/cp_model.rb', line 29 def inspect to_s end |
#sum(arr) ⇒ Object
25 26 27 |
# File 'lib/or_tools/cp_model.rb', line 25 def sum(arr) arr.sum(SatLinearExpr.new) end |