Class: Gecode::Constraints::Int::Linear::ExpressionNode

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/gecoder/interface/constraints/int/linear.rb

Overview

Describes a single node in a linear expression.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LeftHandSideMethods

#must, #must_not

Constructor Details

#initialize(value, model = nil) ⇒ ExpressionNode

Returns a new instance of ExpressionNode.



278
279
280
281
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 278

def initialize(value, model = nil)
  @value = value
  @model = model
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



276
277
278
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 276

def model
  @model
end

Instance Method Details

#to_minimodel_lin_expObject

Converts the linear expression to an instance of Gecode::Raw::MiniModel::LinExpr



285
286
287
288
289
290
291
292
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 285

def to_minimodel_lin_exp
  expression = @value
  if expression.respond_to? :bind
    # Minimodel requires that we do this first.
    expression = expression.bind * 1
  end
  expression
end