Class: Gecode::Constraints::Int::Linear::ExpressionNode
- Inherits:
-
Object
- Object
- Gecode::Constraints::Int::Linear::ExpressionNode
- Includes:
- Helper
- Defined in:
- lib/gecoder/interface/constraints/int/linear.rb
Overview
Describes a single node in a linear expression.
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(value, model = nil) ⇒ ExpressionNode
constructor
A new instance of ExpressionNode.
-
#to_minimodel_lin_exp ⇒ Object
Converts the linear expression to an instance of Gecode::Raw::MiniModel::LinExpr.
Methods included from LeftHandSideMethods
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
#model ⇒ Object (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_exp ⇒ Object
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 |