class Gecode::IntEnum::Sort::SortConstraintWithOptions

Public Instance Methods

post() click to toggle source
# File doc/tmp/rdoc_dev/gecoder/interface/constraints/int_enum/sort.rb, line 81
def post
  if @params[:target].nil?
    # We must have a target.
    lhs = @params[:lhs].to_int_enum
    @params[:target] = @model.int_var_array(lhs.size, lhs.domain_range)
  end
  
  # Prepare the parameters.
  params = @params.values_at(:lhs, :target, :order).map do |param| 
    if param.respond_to? :to_int_enum
      param.to_int_enum.bind_array
    else
      param
    end
  end.delete_if{ |param| param.nil? }
  params.concat propagation_options
  
  # Post the constraint.
  Gecode::Raw::sorted(@model.active_space, *params)
end